Describe the bug
The generated targets for ninja clang-format and ninja clang-tidy run against, and in the case of clang-format modify, source in subprojects.
$ md5sum subprojects/cxxopts-2.2.0/src/example.cpp
8a46e7a4065d2ba30c0879480cc14b33 subprojects/cxxopts-2.2.0/src/example.cpp
$ ninja clang-format
$ md5sum subprojects/cxxopts-2.2.0/src/example.cpp
ffe31934802efea01f8c1df3f3eb1cf8 subprojects/cxxopts-2.2.0/src/example.cpp
To Reproduce
meson wrap install cxxopts.subproject('cxxopts').get_variable('cxxopts_dep').ninja clang-format.Expected behavior
The clang-format rule should not modify source under subprojects.
Ideally, clang-tidy can be skipped on subprojects since they might have different quality standards than the including project.
system parameters
Native.
Gentoo [stable].
$ python --version
Python 3.7.7
meson --version$ meson --version
0.54.1
ninja --version if it's a Ninja build$ ninja --version
1.9.0.git.kitware.dyndep-1.jobserver-1
The problem here being that other people really do want to run those tools for subprojects by default. A simple solution is to add a .clang-format file that disables all formatting in the subprojects dir.
I understand you might want to run clang-tidy on the subprojects, but I don't understand why you'd want to reformat code you got from elsewhere (via clang-format).
In the case of clang-tidy there isn't a good way with the .clang-tidy file to ignore the subprojects repository (or at least I can't find one). If I pick up a simple subproject like google-test, I have to either run with exactly the same clang-tidy settings they did or I get lots of failures. This makes the generated ninja clang-tidy recipe useless for any kind of CI.
Is there any way to create an option to include / exclude subprojects for these generated recipes?
Most helpful comment
I understand you might want to run clang-tidy on the subprojects, but I don't understand why you'd want to reformat code you got from elsewhere (via clang-format).
In the case of clang-tidy there isn't a good way with the .clang-tidy file to ignore the subprojects repository (or at least I can't find one). If I pick up a simple subproject like google-test, I have to either run with exactly the same clang-tidy settings they did or I get lots of failures. This makes the generated
ninja clang-tidyrecipe useless for any kind of CI.Is there any way to create an option to include / exclude subprojects for these generated recipes?