einpoklum
einpoklum

Reputation: 132128

How can I get clang-tidy not to complain about lack of apostrophe in an identifier?

My IDE is running clang-tidy (v20) on my C++ code. I have an enum where one of the identifiers is isnt_owning. And - clang tidy complains about the typo. <sarcasm>Thanks a bunch! I'll go right ahead and fix it by calling my enum value isn't_owning, I'm sure my compiler would be thrilled!</sarcasm>

So, how can I make clang tidy continue checking for typos, but not make this rather inane kind of complaint? Or - is it actually a clang-tidy bug I should report?

Upvotes: 0

Views: 61

Answers (1)

Rud48
Rud48

Reputation: 1059

Here are various ways to suppress linting in general, not just spelling.

auto isnt_1{0}; // NOLINT - just this line

//  NOLINTNEXTLINE(???)  can't find a warning ??? to suppress for spelling
auto isnt_2{0};           // shows error

// NOLINTBEGIN              suppress lint on a block
auto isnt_3{0};
auto isnt_4{0};
// NOLINTEND

auto isnt_5{0};       // shows misspelling because line active

Upvotes: 0

Related Questions