cppcheck-vs-addin
cppcheck-vs-addin copied to clipboard
Check files after save should show results from current file only
It will be a good enhancement to show cppcheck results from the currently saved file only when Check files after save option is selected. This will also increase save performance on large projects. This can be done by ignoring includes when analysisOnSavedFile is true in getCPPCheckArgs
Checking C++ code without parsing includes is generally useless, in my opinion. Yes, it will be faster, but you'll be checking invalid code with unknown symbols for classes included from elsewhere. Only compilable code should be checked.
I provided one possible solution. Other alternative is to filter the results for current file only. One or both options can be offered to the user in settings. When running the check on a project/solution I agree we must have all the includes. But when saving a file I want it to be very quick and show errors from the current files only.
Yes, that's a good point. And I want it to be very quick, too, but it's just not possible to combine good speed with the quality of checks (at least not with cppcheck).
I have fixed this locally and is working as expected for me. If you want I can send you my code. I checked the documentation for cppcheck and most of the checks will work without inclusion of headers. For e.g. Uninitialized variables, UnusedVar checks etc. This is a good compromise for me where I have 500+ projects in my solution and save was taking a bit longer. Also it was returning lots of errors from files that I am not changing. Thanks.
- Excluding messages from other files is great, if you can commit it separately - please go ahead.
- Not using include paths is something I would like to see as an option, not an always-on feature. Can you do that?
I will work on 2. to start with. Will create an option where user can select if they would like to exclude the include path. This is my first OSS contribution to I will need help with the contribution process.
Is this option available today? show cppcheck results from the currently saved file only when Check files after save option is selected
Thanks
@Nir-Az, this isn't implemented but it can be done in principle.