[PATCH] D77983: clang-tidy doc: add a note for every checker with an autofix
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 13 05:52:47 PDT 2020
alexfh added inline comments.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/abseil-duration-conversion-cast.rst:29-35
Note: In the second example, the suggested fix could yield a different result,
as the conversion to integer could truncate. In practice, this is very rare,
and you should use ``absl::Trunc`` to perform this operation explicitly instead.
+
+.. note::
+
+ This checker provides an automatic fix callable with ``--fix``.
----------------
A few problems with this approach:
1. Some checkers' docs already have more specific wording about the fix. Adding a generic phase doesn't make the documentation look neat.
2. The "callable with --fix" part isn't relevant to all clang-tidy frontends. Even for the CLI a reference to the documentation would be more helpful than a mention of this command-line option (there are other relevant options and ways to apply a fix - --fix-errors, -export-fixes + the clang-apply-fixes tool, etc.).
My proposal is to add a mandatory `Automatic fixes` or `Suggested fixes` section to all checker documentation files, require the authors to describe the nature of the fix more thoroughly, and use consistent wording when there is no fix. E.g.
```
Automatic Fixes
^^^^^^^^^^^^^
The check doesn't provide an automatic fix.
```
or
```
Automatic Fixes
^^^^^^^^^^^^^
The check provides suggested fixes. See the documentation above for the details.
```
or
```
Automatic Fixes
^^^^^^^^^^^^^
The check provides suggested fixes in the following cases:
1.
2.
3.
```
WDYT?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77983/new/
https://reviews.llvm.org/D77983
More information about the cfe-commits
mailing list