-
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
addons/namingng.py: Fix commandline use. #5793
Conversation
d1a493f
to
4501592
Compare
5b06e20
to
fcb7cb5
Compare
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.
thanks for giving this addon a bit of attention
I got feedback in a different PR that a unit test should be implemented, so I did. To test |
89bccef
to
e5e39b9
Compare
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.
if you test the addon properly with test-other.py then I do not feel that the --verify
option is needed and then we don't need to return errors from reportError..
namingng.py was only usable in standalone mode, but now supports CLI mode, i.e. with cppcheck --addon=namingng. It uses the generic reporting provided by cppcheckdata.reportError(). All output other than reported errors is suppressed. A local function reportNamingError() is implemented to call through to cppcheckdata.reportError(), filling in common defaults. The collection of errors and the --verify feature are removed, including related workflow and a test file. These are replaced by a unit test, which now also covers (include) file naming.
Confusingly, the example config file for namingng.py was named naming.json, while another addon naming.py can be used using a *different* file that is also named naming.json, residing in a different directory. The feature where an addon can be named addon.json, referring with its "script" key to the actual addon script, further adds to possible confusion. By renaming the default namingng config file from naming.json to namingng.config.json, it is made explicit that this file is a config file for the namingng.py addon. A file namingng.json is added as an example file to be used using --addon=namingng.json. This matches the setup of namingng as created and tested in test-other.py.
I did a cleanup and put all of it in one commit, as all changes are intertwined. The test case is not as elaborate as the Furthermore, I added a commit from a different pending PR, regarding the naming of the default namingng config file. I also added a |
Thanks for working on this. I also ran into some of the issues with the addon and also filed https://trac.cppcheck.net/ticket/12005 about it not being working. I guess that ticket is now fixed. I was considering to deprecate this addon as it was never maintained or tested at all after it was upstreamed (this applies to several addons). That's the reason I didn't post several changes I made to get it working. I am looking at them right now if there is still something to salvage. As this addon is now getting more attention I wonder if we should deprecate the |
@@ -446,8 +446,6 @@ jobs: | |||
python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.c.dump | |||
../../cppcheck --dump naming_test.cpp | |||
python3 ../naming.py --var='[a-z].*' --function='[a-z].*' naming_test.cpp.dump | |||
../../cppcheck --dump namingng_test.c |
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.
We should at least keep a basic test to make sure it still works in standalone mode.
I could simply implement update: #5846 implements the suggestion above |
namingng.py was only usable in standalone mode, but now supports CLI mode, i.e. with cppcheck --addon=namingng. It uses the generic reporting provided by cppcheckdata.reportError(). All output other than reported errors is suppressed.
A local function reportNamingError() is implemented to call through to cppcheckdata.reportError(), filling in common defaults.
The collection of errors and the --verify feature are removed, including related workflow and a test file. These are replaced by a unit test.