-
Notifications
You must be signed in to change notification settings - Fork 5.3k
ci: run clang-tidy as a part of CI #4666
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
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
00fb3b5
ci: add CI script to run clang-tidy
lizan ce3d2c6
remove debug
lizan 81565c3
add more comments
lizan 48e6eb3
add ci doc
lizan 9a94f10
Merge remote-tracking branch 'upstream/master' into clang_tidy
lizan fac609e
fix typo
lizan 3441099
Cleaning up .clang-tidy
lizan 67bea26
add braces check
lizan f55bfd3
run against diff
lizan 1406e3b
fix path
lizan b1936dc
Merge remote-tracking branch 'upstream/master' into clang_tidy
lizan 7817f46
update build image
lizan 8ad5da9
Merge remote-tracking branch 'upstream/master' into clang_tidy
lizan 125ba28
Merge remote-tracking branch 'upstream/master' into clang_tidy
lizan 8078e74
review comments
lizan 6904c85
test clang-tidy
lizan 7cd3c85
Revert "test clang-tidy"
lizan cf09277
Merge remote-tracking branch 'upstream/master' into clang_tidy
lizan 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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| Checks: 'clang-diagnostic-*,clang-analyzer-*,abseil-*,bugprone-*,modernize-*,performance-*,readability-redundant-*,readability-braces-around-statements' | ||
|
|
||
| #TODO(lizan): grow this list, fix possible warnings and make more checks as error | ||
| WarningsAsErrors: 'bugprone-assert-side-effect,modernize-make-shared,modernize-make-unique,readability-redundant-smartptr-get,readability-braces-around-statements' | ||
|
|
||
| CheckOptions: | ||
| - key: bugprone-assert-side-effect.AssertMacros | ||
| value: 'ASSERT' | ||
|
|
||
| - key: bugprone-dangling-handle.HandleClasses | ||
| value: 'std::basic_string_view;std::experimental::basic_string_view;absl::string_view' | ||
|
|
||
| - key: modernize-use-auto.MinTypeNameLength | ||
| value: '10' |
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
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 |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| echo "Generating compilation database..." | ||
| # The compilation database generate script doesn't support passing build options via CLI. | ||
| # Writing them into bazelrc | ||
| echo "build ${BAZEL_BUILD_OPTIONS}" >> .bazelrc | ||
|
|
||
| # bazel build need to be run to setup virtual includes, generating files which are consumed | ||
| # by clang-tidy | ||
| "${ENVOY_SRCDIR}/tools/gen_compilation_database.py" --run_bazel_build | ||
|
|
||
| # It had to be in ENVOY_CI_DIR to run bazel to generate compile database, but clang-tidy-diff | ||
| # diff against current directory, moving them to ENVOY_SRCDIR. | ||
| mv ./compile_commands.json "${ENVOY_SRCDIR}/compile_commands.json" | ||
| cd "${ENVOY_SRCDIR}" | ||
|
|
||
| if [[ "${RUN_FULL_CLANG_TIDY}" == 1 ]]; then | ||
| echo "Running full clang-tidy..." | ||
| run-clang-tidy-7 | ||
| elif [[ -z "${CIRCLE_PR_NUMBER}" && "$CIRCLE_BRANCH" == "master" ]]; then | ||
| echo "On master branch, running clang-tidy-diff against previous commit..." | ||
| git diff HEAD^ | clang-tidy-diff-7.py -p 1 | ||
| else | ||
| echo "Running clang-tidy-diff against master branch..." | ||
| git fetch https://github.com/envoyproxy/envoy.git master | ||
| git diff $(git merge-base HEAD FETCH_HEAD)..HEAD | clang-tidy-diff-7.py -p 1 | ||
| 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.
Uh oh!
There was an error while loading. Please reload this page.