0

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:
Peter Kasting
2020-10-19 01:48:29 +00:00
committed by Commit Bot
parent a0bd478d84
commit 0dc33482fb
3 changed files with 15 additions and 36 deletions

@ -1,4 +1,3 @@
---
---
Checks: '-*,
bugprone-string-integer-assignment,
@ -25,6 +24,8 @@
modernize-use-transparent-functors,
readability-redundant-member-init'
CheckOptions:
- key: modernize-use-default-member-init.UseAssignment
value: 1
# This relaxes modernize-use-emplace in some cases; we might want to make it
# more aggressive in the future. See discussion on
# 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
$ ${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 \
--out_dir out/Linux \
--findings_file all_findings.json \
@ -212,7 +212,7 @@ gn gen . --export-compile-commands
```
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.
# Set the clang-tidy binary path, if it's not in your $PATH.
-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.
-clang-apply-replacements-binary \
<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> \
-header-filter=<FILTER> \# Optional, limit results to only certain files.
-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):
<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> \
-header-filter=<FILTER> \
-fix \
chrome/browser
'chrome/browser/.*'
```
\*It's not clear which, if any, `gn` flags may cause issues for
`clang-tidy`. I've had no problems building a component release build,
both with and without goma. if you run into issues, let us know!
Note that the source file regex must match how the build specified the file.
This means that on Windows, you must use (escaped) backslashes even from a bash
shell.
### Questions

@ -1,29 +1,7 @@
---
Checks: '-*,
google-build-namespaces,
google-explicit-constructor,
google-readability-casting,
google-readability-namespace-comments,
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
Checks: 'google-build-namespaces,
google-readability-namespace-comments,
modernize-replace-auto-ptr,
modernize-use-using'
HeaderFilterRegex: 'ui/views/*'
...