-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
generate AddonInfo
only once
#4958
Conversation
Still needs a bit of work as well as unit tests. I removed the CI files so this does not trigger a build to ease things. |
It's a bit problematic that the But I also wanted to issue a proper error when it cannot be opened. Currently it will write an error message to the command-line (two per file) and set the exitcode to failure without reporting anything in the results. In terms of the GUI execution the caching might also be problematic as the file might change during scans. But we have the same issue with other modifications of the settings during a scan. I assume there might be several multi-session issues when using the GUI. I guess I will file a ticket for that instead since that seems like a major side task I cannot do. |
I like the idea not load the addoninfo in cppcheck class for each TU. |
This highlights that the |
After the changes in #4967 I think I know where the addons should be loaded - at the same stage when the libraries are being loaded. |
560e1d6
to
122cc6c
Compare
7d0f1be
to
3d1281e
Compare
I placed the code in the proper common place now and also added an assert to make sure that all the |
I got some weird results in my manual testing so I am improving the errorhandling and testing of the addons to figure out what is going on. Will probably be a separate PR first. |
8c08107
to
18e873d
Compare
dd3c8ca
to
9d52fe2
Compare
I did profile the code before and after and there is no significant difference. Any additional optimizations I made while working on this were already merged in #5451. It will invoke less commands though which should help with the execution time still. |
This is finally ready for review. |
|
||
if (obj.count("python")) { | ||
// Python was defined in the config file | ||
if (obj["python"].is<picojson::array>()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the feeling this should say if (!obj["python"].is<std::string>())
instead .. I have no idea why the old code checked for the array instead :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Will have a look and add some tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code made sure it is not an array. So that is fine albeit a rather specific handling. Will still adjust though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This requires a lot of new tests to be written. I will do this in a follow-up PR so this can be merged.
overall.. I think this looks good and promising 👍 |
Currently the
AddonInfo
is generated and discarded on each addon invocation. This leads to an unnecessary process invocation for each addon on each file.Also if an addon is completely broken we will still perform the whole analysis only for it to be failed at the end so we should bail out early if we know it doesn't work at all.