Hi, my first post got caught in the spam filter so hopefully this one goes through.
I'm trying to get cppcheckgui to run clang-tidy on my codebase but I don't think it's working.
My setup:
- Win7, Cppcheck 1.86, LLVM 7.0.1
- Tried both filled and blank Clang path in Preferences
- Clang-tidy enabled in project settings
On an unrelated note, every time I click on "Reanalyze all files", the results would be different.
Sometimes it gets stuck reporting "No errors found" follow by "No errors found, nothing to save" but restarting the GUI seems to help.
Is this the intended behaviour?
Thanks in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Make sure that you have a build dir setup in the project settings.
In the build dir there will be files created during analysis. If I remember correctly you should get files with the name *clang-tidy-cmd that will contain the exact command the GUI uses for each file. And *clang-tidy-results that will contain the results. Do you see any such files?
Is this the intended behaviour?
hmm I do not think so.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hmm.. I can reproduce such problem when I do not import any project.
If you click on the "Edit project..." then the first setting you see is "Import project". Is this empty? Otherwise, what kind of project do you import?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes that setting is empty because I set up the project from scratch. The "Analyze all Visual Studio configurations" option is checked but grayed out. Is it required to import a project?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I believe that importing a project should be required to allow that clang-tidy is run. It requires the proper compilation flags. So I need to update the project settings dialog somehow, it should not happily accept such configuration.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I might be missing something because I'm not very familiar with clang-tidy but why can't those compilations flags be set without a project file? What about projects that uses other IDEs or none at all?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are not limited to visual studio. CMake / Makefile / etc build files can be used indirectly if you are able to generate a compilation database from it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ohh ok I can look into generating a database file, thanks.
Any ideas with regard to the weird "Reanalyze all files" behavior I'm seeing?
Is it also related to not importing from a project file?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
why can't those compilations flags be set without a project file?
hmm.. in theory you could specify all the compilation flags in the project settings. but that does not seem very practical to me.
do you have some mismatching project that can't be imported?
Generating the compilation database in Windows is not as easy as in Linux.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hmm.. in theory you could specify all the compilation flags in the project settings. but that does not seem very practical to me.
Ya I didn't think about file specific compilation flags so having a project file to import from is certainly the easiest solution.
do you have some mismatching project that can't be imported?
I'm working with embedded code and the IDE can change from time to time. I'm currently using an eclipse-based IDE. The projects aren't very big so I think generating the compilation database is fine even if I have to write and maintain it manually. Nice to have it in json format :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Did you get any further with the two issues that you presented in this thread? I'm also new to Cppcheck and clang-tidy and am having the exact issues that you're having.
The code that I'm trying to 'lint' comes from an Eclipse based IDE and so there is no make file (as far as I know), so importing is not an option.
Thanks for any insight that you can share, no matter how little.
Mark
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately I had just accepted the random results problem for what it is and basically did what you outlined in your "Output changes on each analysis" post. As for clang-tidy, it took a bit of time to set up but I'm just running it separately with a script.
David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the quick reply. It's a shame this hasn't been fixed yet - I was
hopeful that this would be a great a static analysis tool for our team. We
will have to accept the workaround for now.
Unfortunately I had just accepted the random results problem for what it
is and basically did what you outlined in your "Output changes on each
analysis" post. As for clang-tidy, it took a bit of time to set up but I'm
just running it separately with a script.
It's a shame this hasn't been fixed yet - I was hopeful that this would be a great a static analysis tool for our team. We will have to accept the workaround for now.
Yes it is. This is a hobby project and time is limited. :-(
Would you be willing to sponsor this fix?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, my first post got caught in the spam filter so hopefully this one goes through.
I'm trying to get cppcheckgui to run clang-tidy on my codebase but I don't think it's working.
My setup:
- Win7, Cppcheck 1.86, LLVM 7.0.1
- Tried both filled and blank Clang path in Preferences
- Clang-tidy enabled in project settings
On an unrelated note, every time I click on "Reanalyze all files", the results would be different.
Sometimes it gets stuck reporting "No errors found" follow by "No errors found, nothing to save" but restarting the GUI seems to help.
Is this the intended behaviour?
Thanks in advance.
Make sure that you have a build dir setup in the project settings.
In the build dir there will be files created during analysis. If I remember correctly you should get files with the name
*clang-tidy-cmd
that will contain the exact command the GUI uses for each file. And*clang-tidy-results
that will contain the results. Do you see any such files?hmm I do not think so.
No I don't see those files in the build dir. I tried running cppcheck and clang on a Win10 machine and got the same results.
hmm.. I can reproduce such problem when I do not import any project.
If you click on the "Edit project..." then the first setting you see is "Import project". Is this empty? Otherwise, what kind of project do you import?
Yes that setting is empty because I set up the project from scratch. The "Analyze all Visual Studio configurations" option is checked but grayed out. Is it required to import a project?
I believe that importing a project should be required to allow that clang-tidy is run. It requires the proper compilation flags. So I need to update the project settings dialog somehow, it should not happily accept such configuration.
that is not used unless you import a visual studio project. it does not matter.
I might be missing something because I'm not very familiar with clang-tidy but why can't those compilations flags be set without a project file? What about projects that uses other IDEs or none at all?
To clarify:
"It requires the proper compilation flags."
=>
"clang-tidy requires the proper compilation flags."
You are not limited to visual studio. CMake / Makefile / etc build files can be used indirectly if you are able to generate a compilation database from it.
Ohh ok I can look into generating a database file, thanks.
Any ideas with regard to the weird "Reanalyze all files" behavior I'm seeing?
Is it also related to not importing from a project file?
hmm.. in theory you could specify all the compilation flags in the project settings. but that does not seem very practical to me.
do you have some mismatching project that can't be imported?
Generating the compilation database in Windows is not as easy as in Linux.
no ideas right now. But I do not think it is related.
I gotta go now. Thanks for the chat :-)
Thanks a lot for your help.
PS.
Ya I didn't think about file specific compilation flags so having a project file to import from is certainly the easiest solution.
I'm working with embedded code and the IDE can change from time to time. I'm currently using an eclipse-based IDE. The projects aren't very big so I think generating the compilation database is fine even if I have to write and maintain it manually. Nice to have it in json format :)
Hi David,
Did you get any further with the two issues that you presented in this thread? I'm also new to Cppcheck and clang-tidy and am having the exact issues that you're having.
The code that I'm trying to 'lint' comes from an Eclipse based IDE and so there is no make file (as far as I know), so importing is not an option.
Thanks for any insight that you can share, no matter how little.
Mark
Hi Mark,
Unfortunately I had just accepted the random results problem for what it is and basically did what you outlined in your "Output changes on each analysis" post. As for clang-tidy, it took a bit of time to set up but I'm just running it separately with a script.
David
Hi David,
Thanks for the quick reply. It's a shame this hasn't been fixed yet - I was
hopeful that this would be a great a static analysis tool for our team. We
will have to accept the workaround for now.
Cheers,
Mark
On Wed, 27 Mar 2019 at 20:26, David excsniper@users.sourceforge.net wrote:
Yes it is. This is a hobby project and time is limited. :-(
Would you be willing to sponsor this fix?
Also .. feel free to look into making a fix for this. All you need to install is Qt SDK including Qt Creator..
A patch for this would be very welcome!
Hi Daniel. Thanks for the invitation to participate. I will seriously consider it!