-
Notifications
You must be signed in to change notification settings - Fork 84
Enable clang-tidy job #3062
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
base: main
Are you sure you want to change the base?
Enable clang-tidy job #3062
Changes from all commits
61604ed
7d3f8eb
026d2d1
c29ab79
d5d7f65
96e7b3e
1358822
ffaa7dc
a1c75a2
ec4779b
f96c03f
8c0900a
81f2e28
702dc6c
641fa1a
5434b63
c53d0d9
1a96ac4
3c05940
109b931
3a8b317
bfe5ec1
5aca925
d088b90
0058c41
ea3a972
935d151
1e6daa1
43f160b
d0b8b0b
715a536
f3c92ce
5a07c40
e5016ab
0595cd8
52a1abc
99190e5
b3e4445
de593cf
92fcb68
93395e9
db35537
f239e53
49e9a73
9ca3265
bf0addc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -34,10 +34,19 @@ jobs: | |||||
| export ADDITIONAL_LINTRUNNER_ARGS="--skip CLANGTIDY,CLANGFORMAT,MERGE_CONFLICTLESS_CSV --all-files" | ||||||
| cd ./torch-xpu-ops | ||||||
| bash .github/scripts/lintrunner.sh | ||||||
| - name: Checkout PyTorch (for headers) | ||||||
| uses: actions/checkout@v4 | ||||||
| with: | ||||||
| repository: pytorch/pytorch | ||||||
| path: pytorch-headers | ||||||
| fetch-depth: 1 | ||||||
| submodules: false | ||||||
|
Contributor
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. There are some code gen files that are handled in torch-xpu-ops/.github/scripts/lintrunner.sh Lines 37 to 38 in e3bd5f9
Please ensure these paths are matched.
Contributor
Author
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. I think it would require extracting clang-tidy to separate CI job that builds PyTorch+XPU and pass if [[ "${CLANG}" == "1" ]]; then
if [[ -e "third_party/torch-xpu-ops/tools/linter/clang_tidy/generate_build_files.py" ]];thenare not met. This lightweight version lets us quickly fix issues that reproduce without build dependency. It's fast so can guard any regressions in |
||||||
| - name: Run lint check with Clang | ||||||
| env: | ||||||
| PYTORCH_ROOT: ${{ github.workspace }}/pytorch-headers | ||||||
| run: | | ||||||
| cd ./torch-xpu-ops | ||||||
| export ADDITIONAL_LINTRUNNER_ARGS="--take CLANGFORMAT --all-files" | ||||||
| export ADDITIONAL_LINTRUNNER_ARGS="--take CLANGFORMAT,CLANGTIDY --all-files" | ||||||
| bash .github/scripts/lintrunner.sh | ||||||
|
|
||||||
| conditions-filter-win: | ||||||
|
|
||||||
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.
This file seems different from https://github.com/pytorch/pytorch/blob/main/.clang-tidy. Could you help me understand the difference.
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.
Sure. In upstream config there are groups of checks enabled, for example all checks from
bugprone-category, but some are failing, so individual checks can be skipped with-prefix. It totally disables the check. Also, one can use in-line comment withNOLINT(check-name)to skip particular occurrence of failed check.Some checks are debatable and implementing them is not worth it, so explicit skip allows us to ignore one check while enabling all other checks from this category. One example is modernize-concat-nested-namespaces which enforces squashing namespaces, that is purely formatting that depends mostly on personal preferences.
If we used upstream config without modifications, CI would fail on
preci-lint-checkas we have more issues in codebase than upstream. That's why I extended config with few explicitly skipped checks. Now it will pass CI and guard from further regressions. I plan to create tasks to enable each check one-by-one to not introduce them in one PR.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.
Thanks for your details.