[PATCH] D71963: clang-tidy doc: Add the severities description

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 30 05:35:48 PST 2019


whisperity added a comment.

In D71963#1798199 <https://reviews.llvm.org/D71963#1798199>, @vingeldal wrote:

> - Style: things that are handled by clang-format rather than clang-tidy.


This is not true, for two reasons. The shorter answer: In case it was true, the "severity category" `STYLE` would be a moot point in CodeChecker, as CodeChecker (currently) catalogues and displays CSA and CT diagnostics.

Moreover, there are plenty of stylistic constructs (`readability-`, some `modernise-`, etc.) which are not handled, and maybe can not be handled by `clang-format` on a "token sequence" level.
For example, using `record-member-init-expr`s instead of initializers in the constructor <https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-default-member-init.html> is not something `clang-format` could reasonably fix as per my understanding. It is also not something it //should// fix, whereas a Tidy rule being enabled (or not...) for a project is the project's decision about what stylistics or nomenclature <https://clang.llvm.org/extra/clang-tidy/checks/llvm-header-guard.html> (hah, maybe this check, in particular, should be moved from `low` to `style` @sylvestre.ledru 😈) they want to embrace.

A `low` diagnostics (and everything "above", assuming a(n at least) partial ordering on severities) should mean the coding construct is problematic: there is a chance -- perhaps once in a lifetime, perhaps not -- that doing this will cause a real error. A `style` thing should mean //"Hey, whatever you have written, is pretty much A-Ok! and works, congrats for writing valid (Obj)?C(++)?, but please realise that we are writing DERP/C++-42 and not C89 and please move your loop variable inside the loop's statement"//. No **real** "game-breaking" issue should ever arise from deciding on fixing or ignoring a `style` check's output.

-----

One thing which I forgot to mention (because 99.9999999% of the people don't do it, so it's understandable that it's been missed) is that CodeChecker severities can be fine-tuned as it's literally just a JSON file. I haven't touched actual CodeChecker code for a while now, but I think in in case you rewrite this JSON as you see fit before running an analysis or starting a server, you can go as arbitrary as you want.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71963/new/

https://reviews.llvm.org/D71963





More information about the cfe-commits mailing list