-
Notifications
You must be signed in to change notification settings - Fork 57
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
Detection of .clang-tidy file not working #1342
Comments
Hi @johanneskopf, I apologize for a late reply It is not enough to remove .clang-tidy from your project .clang-tidy file is detected by clang-tidy.exe (not by us) based on its predefined search paths. When we run clang-tidy.exe without specifying a configuration file explicitly ( Current directory: clang-tidy.exe will first look for .clang-tidy in the directory from which it is being executed. If you have some custom checks, you can export .clang-tidy file (from Settings -> tidy) and use it in your project Let me know if this helps Kind regards, |
Hi @mariru27 , Thanks for the reply. And no worries for the answer time, that is still quick enough! :) That explains it to some degree. I already did the export of my custom checks (see step 6. of my initial post above) and that runs fine now, but I still want to figure out which .clang-tidy file it uses when this manually exported .clang-tidy file is not given. I don't have any .clang-tidy file in a parent folder of my project. As a next step, I try to figure out where I find the clang-tidy executable on Windows (EDIT: found it here: "%APPDATA%\ClangPowerTools\LLVM\LLVM17.0.1\bin" (adapt path depending on downloaded LLVM version)) and then add it to path environment variable, before I can execute it in a console window, and afterwards I'll search if there's a way to display the used .clang-tidy file. I have an idea here though: Is it possible to display the path of the found .clang-tidy file in the clang power tools? That would be super helpful. Even better would be to display it as a hyperlink that opens the file explorer at the corresponding folder and highlights the used .clang-tidy file. Kind regards, |
We know path to .clang-tidy file, just when you use It's the single case when we know If you want to display the .clang-tidy path from Have a nice day, |
I see, thanks for the explanation! To summarize, my problem is that clang-tidy uses a .clang-tidy file that I could not find on disk, but clang-tidy obviously did. As a result, I created an issue at the LLVM project that hopefully leads to a solution: llvm/llvm-project#88242 I am interested in a general solution to output all .clang-tidy files that are used. But I acknowledge that this can only be solved on the LLVM side. So let's wait if they can help us out here. Have a great day, |
Got a solution in llvm/llvm-project#88242
So by using the --explain-config flag, I was able to figure out that in the case where it can't find a .clang-tidy file, it uses the clang-tidy options specified in the binary. This was the piece of information I was missing. As a result, is it possible that Also, finding this flag means that it is actually possible to retrieve the paths to all the clang-tidy files involved. I believe that adding this information to the UI would definitely be beneficial. |
Steps to reproduce
Use checks from = PredefinedChecks
, enable just one or two checks, and setDetect .clang-tidy file = true
Use checks from = PredefinedChecks
toUse checks from = TidyFile
. Expected behavior: As there is no ".clang-tidy" file in my project, it should stay atUse checks from = PredefinedChecks
according to the tooltip of that option.Tidy file config - Export
button to export the .clang-tidy file to my project root, it used these options when right clicking on project - Clang Power Tools - Tidy.Versions of the tools used:
2023.9.0
17.0.1
2022, 17.9.3, 64-bit
The text was updated successfully, but these errors were encountered: