Updates for things I ran into while running clang-tidy locally.
* Make ui/views/.clang-tidy additive to the base file, not a replacement. * Hoist the "use equals" config option to the base file, since that's Chromium style. * Update docs for errors or inclarities. Bug: none Change-Id: I7f22db99d9ff11fc91665776887a02f7184427ae Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2483344 Auto-Submit: Peter Kasting <pkasting@chromium.org> Commit-Queue: George Burgess <gbiv@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org> Cr-Commit-Position: refs/heads/master@{#818330}
This commit is contained in:

committed by
Commit Bot

parent
a0bd478d84
commit
0dc33482fb
@@ -1,4 +1,3 @@
|
|||||||
---
|
|
||||||
---
|
---
|
||||||
Checks: '-*,
|
Checks: '-*,
|
||||||
bugprone-string-integer-assignment,
|
bugprone-string-integer-assignment,
|
||||||
@@ -25,6 +24,8 @@
|
|||||||
modernize-use-transparent-functors,
|
modernize-use-transparent-functors,
|
||||||
readability-redundant-member-init'
|
readability-redundant-member-init'
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
|
- key: modernize-use-default-member-init.UseAssignment
|
||||||
|
value: 1
|
||||||
# This relaxes modernize-use-emplace in some cases; we might want to make it
|
# This relaxes modernize-use-emplace in some cases; we might want to make it
|
||||||
# more aggressive in the future. See discussion on
|
# more aggressive in the future. See discussion on
|
||||||
# https://groups.google.com/a/chromium.org/g/cxx/c/noMMTNYiM0w .
|
# https://groups.google.com/a/chromium.org/g/cxx/c/noMMTNYiM0w .
|
||||||
|
@@ -75,7 +75,7 @@ clang-tidy across all of Chromium is a single command:
|
|||||||
|
|
||||||
```
|
```
|
||||||
$ cd ${chromium}/src
|
$ cd ${chromium}/src
|
||||||
$ ${chromium_build}/scripts/slave/recipe_modules/tricium_clang_tidy/resources/tricium_clang_tidy.py \
|
$ ${chromium_build}/recipes/recipe_modules/tricium_clang_tidy/resources/tricium_clang_tidy.py \
|
||||||
--base_path $PWD \
|
--base_path $PWD \
|
||||||
--out_dir out/Linux \
|
--out_dir out/Linux \
|
||||||
--findings_file all_findings.json \
|
--findings_file all_findings.json \
|
||||||
@@ -212,7 +212,7 @@ gn gen . --export-compile-commands
|
|||||||
```
|
```
|
||||||
4. Run clang-tidy.
|
4. Run clang-tidy.
|
||||||
```
|
```
|
||||||
<PATH_TO_LLVM_SRC>/clang-tidy/tool/run-clang-tidy.py \
|
<PATH_TO_LLVM_SRC>/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \
|
||||||
-p . \# Set the root project directory, where compile_commands.json is.
|
-p . \# Set the root project directory, where compile_commands.json is.
|
||||||
# Set the clang-tidy binary path, if it's not in your $PATH.
|
# Set the clang-tidy binary path, if it's not in your $PATH.
|
||||||
-clang-tidy-binary <PATH_TO_LLVM_BUILD>/bin/clang-tidy \
|
-clang-tidy-binary <PATH_TO_LLVM_BUILD>/bin/clang-tidy \
|
||||||
@@ -220,11 +220,11 @@ gn gen . --export-compile-commands
|
|||||||
# and you are using the `fix` behavior of clang-tidy.
|
# and you are using the `fix` behavior of clang-tidy.
|
||||||
-clang-apply-replacements-binary \
|
-clang-apply-replacements-binary \
|
||||||
<PATH_TO_LLVM_BUILD>/bin/clang-apply-replacements \
|
<PATH_TO_LLVM_BUILD>/bin/clang-apply-replacements \
|
||||||
# The checks to employ in the build. Use `-*` to omit default checks.
|
# The checks to employ in the build. Use `-*,...` to omit default checks.
|
||||||
-checks=<CHECKS> \
|
-checks=<CHECKS> \
|
||||||
-header-filter=<FILTER> \# Optional, limit results to only certain files.
|
-header-filter=<FILTER> \# Optional, limit results to only certain files.
|
||||||
-fix \# Optional, used if you want to have clang-tidy auto-fix errors.
|
-fix \# Optional, used if you want to have clang-tidy auto-fix errors.
|
||||||
chrome/browser # The path to the files you want to check.
|
'chrome/browser/.*' # A regex of the files you want to check.
|
||||||
|
|
||||||
Copy-Paste Friendly (though you'll still need to stub in the variables):
|
Copy-Paste Friendly (though you'll still need to stub in the variables):
|
||||||
<PATH_TO_LLVM_SRC>/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \
|
<PATH_TO_LLVM_SRC>/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py \
|
||||||
@@ -235,12 +235,12 @@ Copy-Paste Friendly (though you'll still need to stub in the variables):
|
|||||||
-checks=<CHECKS> \
|
-checks=<CHECKS> \
|
||||||
-header-filter=<FILTER> \
|
-header-filter=<FILTER> \
|
||||||
-fix \
|
-fix \
|
||||||
chrome/browser
|
'chrome/browser/.*'
|
||||||
```
|
```
|
||||||
|
|
||||||
\*It's not clear which, if any, `gn` flags may cause issues for
|
Note that the source file regex must match how the build specified the file.
|
||||||
`clang-tidy`. I've had no problems building a component release build,
|
This means that on Windows, you must use (escaped) backslashes even from a bash
|
||||||
both with and without goma. if you run into issues, let us know!
|
shell.
|
||||||
|
|
||||||
### Questions
|
### Questions
|
||||||
|
|
||||||
|
@@ -1,29 +1,7 @@
|
|||||||
---
|
---
|
||||||
Checks: '-*,
|
Checks: 'google-build-namespaces,
|
||||||
google-build-namespaces,
|
google-readability-namespace-comments,
|
||||||
google-explicit-constructor,
|
modernize-replace-auto-ptr,
|
||||||
google-readability-casting,
|
modernize-use-using'
|
||||||
google-readability-namespace-comments,
|
HeaderFilterRegex: 'ui/views/*'
|
||||||
modernize-avoid-bind,
|
|
||||||
modernize-loop-convert,
|
|
||||||
modernize-make-shared,
|
|
||||||
modernize-make-unique,
|
|
||||||
modernize-redundant-void-arg,
|
|
||||||
modernize-replace-auto-ptr,
|
|
||||||
modernize-replace-random-shuffle,
|
|
||||||
modernize-shrink-to-fit,
|
|
||||||
modernize-use-bool-literals,
|
|
||||||
modernize-use-default-member-init,
|
|
||||||
modernize-use-emplace,
|
|
||||||
modernize-use-equals-default,
|
|
||||||
modernize-use-noexcept,
|
|
||||||
modernize-use-nullptr,
|
|
||||||
modernize-use-override,
|
|
||||||
modernize-use-transparent-functors,
|
|
||||||
modernize-use-using,
|
|
||||||
readability-redundant-member-init'
|
|
||||||
HeaderFilterRegex: 'ui/views/*'
|
|
||||||
CheckOptions:
|
|
||||||
- key: modernize-use-default-member-init.UseAssignment
|
|
||||||
value: 1
|
|
||||||
...
|
...
|
||||||
|
Reference in New Issue
Block a user