最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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?

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?

Share Improve this question edited 18 hours ago einpoklum asked 19 hours ago einpoklumeinpoklum 132k76 gold badges412 silver badges844 bronze badges 12
  • Can you add isnt to the word list that clang-tidy is using? – Eljay Commented 19 hours ago
  • @Eljay: I can, but that defeats the purpose of running a spell checker, since what if I forget an apostrophe in a comment? – einpoklum Commented 19 hours ago
  • If you can wait until C++26 you can write it as isn`t_owning. All better! – Botje Commented 19 hours ago
  • 2 not_working or just turn off spell checking. Who spell checks code? – Geoduck Commented 19 hours ago
  • 1 @Geoduck: Sorrry, mis-typed my question here, it's owning, not working. But that's a decent idea. Doesn't answer the question though, plus, sometimes, not_working implies that the value is the same as not (is_working) - which may not be the case. – einpoklum Commented 18 hours ago
 |  Show 7 more comments

1 Answer 1

Reset to default 0

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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论