-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
xmake check clang.tidy
passes non-C++ files by default
#5584
Comments
xmake check clang.tidy
passes non-C++ filesxmake check clang.tidy
passes non-C++ files by default
You shouldn't use is_host but is_plat to test platforms, even though I don't think it fixes this issue |
Why I shouldn't use |
In your case you should use |
Clang is a toolchain, not a platform, when you're using Clang you're still targeting the windows platform. ( |
Meanwhile I am adding new option to clang.tidy check: -i, ignore Set files ignore pattern
e.g.
- xmake check clang.tidy -i '*.rc;*.proto'
By default it's *.rc |
Maybe we should reverse it and make it as "included extensions". Source files can include anything using rules (even binary files, e.g. utils.bin2c). |
try this patch. #5586 |
Now |
try it again. |
Now it works fine! By the way, I noticed that clang-tidy called multiple times (once per each c++ file). Have you considered that all c++ files can be passed to clang-tidy at once? I am asking because it's much more easier to fix all c++ files once (for example from clang-tidy CI output) than fixing one file, then discovering new errors in second file and so on. |
try it again. #5592 But I'm not sure if this will cause problems if there are over 10000 of source files in a large project. There may also be a limit on the length of the parameters. (e.g. windows argument limit) Perhaps testing one by one is the most stable way. |
I tested it and it works fine. All C++ project files are passed in the one row (one clang-tidy call). Regarding cli option string length limit: |
Also worth to mention this PR in clang project: #103499 avoid limits on number of sources by accepting a params file |
It doesn't solve the problem. The length limit still exists, when too much source files are encountered. |
But it's not supported right now. |
Xmake Version
2.9.4
Operating System Version and Architecture
Windows 11 23H2 22631.4037
Describe Bug
When non C++ files are present in sources, for example Windows icon file
icon.rc
Then it passed to clang-tidy and check is broken since .rc is not a C++ file:
I know about
-f *.cpp
option, but it's slightly inconvenient to pass it each time.Expected Behavior
By default need to ignore such non C++ files when passing files to clang-tidy.
Maybe need to have regex pattern to ignored filenames or something like this?
Project Configuration
Additional Information and Error Logs
There is code which handles adding files to the sourcelist which passed to clang-tidy:
xmake/xmake/modules/private/check/checkers/clang/tidy.lua
Line 138 in dbf5b76
And then:
xmake/xmake/modules/private/check/checkers/clang/tidy.lua
Line 72 in dbf5b76
The text was updated successfully, but these errors were encountered: