Skip to content
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

Check files after save should show results from current file only #162

Open
bhadreshdesai opened this issue Mar 31, 2017 · 8 comments
Open

Comments

@bhadreshdesai
Copy link

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

@VioletGiraffe
Copy link
Owner

VioletGiraffe commented Mar 31, 2017

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.

@bhadreshdesai
Copy link
Author

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.

@VioletGiraffe
Copy link
Owner

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).

@bhadreshdesai
Copy link
Author

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.

@VioletGiraffe
Copy link
Owner

VioletGiraffe commented Mar 31, 2017

  1. Excluding messages from other files is great, if you can commit it separately - please go ahead.
  2. Not using include paths is something I would like to see as an option, not an always-on feature. Can you do that?

@bhadreshdesai
Copy link
Author

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.

@Nir-Az
Copy link

Nir-Az commented Aug 9, 2020

Is this option available today?
show cppcheck results from the currently saved file only when Check files after save option is selected

Thanks

@VioletGiraffe
Copy link
Owner

@Nir-Az, this isn't implemented but it can be done in principle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants