-
Notifications
You must be signed in to change notification settings - Fork 5.3k
ci: fix clang-tidy #10496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
ci: fix clang-tidy #10496
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ TAGS | |
| .vimrc | ||
| .vs | ||
| .vscode | ||
| clang-tidy-fixes.yaml | ||
| clang.bazelrc | ||
| user.bazelrc | ||
| CMakeLists.txt | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ export LLVM_CONFIG=${LLVM_CONFIG:-llvm-config} | |
| LLVM_PREFIX=${LLVM_PREFIX:-$(${LLVM_CONFIG} --prefix)} | ||
| CLANG_TIDY=${CLANG_TIDY:-$(${LLVM_CONFIG} --bindir)/clang-tidy} | ||
| CLANG_APPLY_REPLACEMENTS=${CLANG_APPLY_REPLACEMENTS:-$(${LLVM_CONFIG} --bindir)/clang-apply-replacements} | ||
| FIX_YAML=clang-tidy-fixes.yaml | ||
|
|
||
| # Quick syntax check of .clang-tidy. | ||
| ${CLANG_TIDY} -dump-config > /dev/null 2> clang-tidy-config-errors.txt | ||
|
|
@@ -57,20 +58,30 @@ function filter_excludes() { | |
|
|
||
| if [[ "${RUN_FULL_CLANG_TIDY}" == 1 ]]; then | ||
| echo "Running full clang-tidy..." | ||
| "${LLVM_PREFIX}/share/clang/run-clang-tidy.py" \ | ||
| python3 "${LLVM_PREFIX}/share/clang/run-clang-tidy.py" \ | ||
| -clang-tidy-binary=${CLANG_TIDY} \ | ||
| -clang-apply-replacements-binary=${CLANG_APPLY_REPLACEMENTS} \ | ||
| -export-fixes=${FIX_YAML} \ | ||
| -j ${NUM_CPUS:-0} -p 1 -quiet \ | ||
| ${APPLY_CLANG_TIDY_FIXES:+-fix} | ||
| elif [[ "${BUILD_REASON}" != "PullRequest" ]]; then | ||
| echo "Running clang-tidy-diff against previous commit..." | ||
| git diff HEAD^ | filter_excludes | \ | ||
| "${LLVM_PREFIX}/share/clang/clang-tidy-diff.py" \ | ||
| python3 "${LLVM_PREFIX}/share/clang/clang-tidy-diff.py" \ | ||
| -clang-tidy-binary=${CLANG_TIDY} \ | ||
| -p 1 | ||
| -export-fixes=${FIX_YAML} \ | ||
| -j ${NUM_CPUS:-0} -p 1 -quiet | ||
| else | ||
| echo "Running clang-tidy-diff against master branch..." | ||
| git diff "remotes/origin/${SYSTEM_PULLREQUEST_TARGETBRANCH}" | filter_excludes | \ | ||
| "${LLVM_PREFIX}/share/clang/clang-tidy-diff.py" \ | ||
| python3 "${LLVM_PREFIX}/share/clang/clang-tidy-diff.py" \ | ||
| -clang-tidy-binary=${CLANG_TIDY} \ | ||
| -p 1 | ||
| -export-fixes=${FIX_YAML} \ | ||
| -j ${NUM_CPUS:-0} -p 1 -quiet | ||
| fi | ||
|
|
||
| if [[ -s "${FIX_YAML}" ]]; then | ||
| echo "clang-tidy check failed, potentially fixed by clang-apply-replacements:" | ||
| cat ${FIX_YAML} | ||
| exit 1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice workaround to the non-informative exit code |
||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we regressing anything by eliminating these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are checked but not enforced before but I don't think anyone is looking at it. So just check what we are enforcing. Then all errors are written to the fix yaml file so we can check in bash easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we get this fixed is it possible to do a complete master run and fix all the regressions? I'm sure there are a lot. Thanks for doing this. Very excited to get this fixed!