Problem
Currently, the clang-tidy hook only reports issues but does not apply
fixes. Users must manually run clang-tidy --fix or interpret the
suggestions themselves. This is inconsistent with the clang-format hook,
which already auto-formats files in place.
Proposed Solution
Add an --fix argument to the clang-tidy hook that passes -fix to
clang-tidy internally:
- id: clang-tidy
args: [--checks=.clang-tidy, --fix]
This should be opt-in (not the default) since auto-fixing can be
destructive and requires a clean compilation database to work correctly.
Notes
∙ -fix requires a valid compile_commands.json in most cases.
∙ Should document that -fix-errors is also available for cases where
compiler errors exist alongside style issues.
Problem
Currently, the clang-tidy hook only reports issues but does not apply
fixes. Users must manually run
clang-tidy --fixor interpret thesuggestions themselves. This is inconsistent with the clang-format hook,
which already auto-formats files in place.
Proposed Solution
Add an
--fixargument to the clang-tidy hook that passes -fix toclang-tidy internally:
This should be opt-in (not the default) since auto-fixing can be
destructive and requires a clean compilation database to work correctly.
Notes
∙ -fix requires a valid compile_commands.json in most cases.
∙ Should document that -fix-errors is also available for cases where
compiler errors exist alongside style issues.