cppcheck.cpp: Check for JSON error when parsing addon .json files#2374
Conversation
| const std::string &failedToGetAddonInfo = addonInfo.getAddonInfo(addon, mSettings.exename); | ||
| if (!failedToGetAddonInfo.empty()) { | ||
| reportOut(failedToGetAddonInfo); | ||
| mExitCode = 1; |
There was a problem hiding this comment.
@danmar I guess this is not correct. It looks like this variable is meant for analysis errors. But in this case, it is an error in an input file. Is there a better way to set the exit code that also does not need --error-exitcode= beeing set?
There was a problem hiding this comment.
For me this feels ok. It's serious if this does not work.
|
For information, it's already implemented in #2367 here (see also: tests and GUI integration). So we'll get errors handing after merging this changes, in next release, I think. |
Yes |
|
@versat I think it's better to merge it for now and replace it later. It is good if the user will have error messages in current release. |
653c7f3 to
98e9c6b
Compare
|
I have added the possibility to check the naming of constants to naming.py. Without this enhancement, the addon does not make so much sense. Constants often are named different than normal variables, and Cppcheck is no exception here. I had to loosen the naming validation rules in naming.json since there are some names that are hard or impossible to fix. For example, a constructor of a class that is inside another class seems to be not marked as a constructor. This results in false positives. So I allowed functions to begin with upper letters for now. I have fixed naming violations in CLI/LIB/GUI so Travis is happy now. |
This fixes that errors in JSON files given via `--addon=*.json` are silently ignored and maybe only a part of the JSON file is used. Now the error message which picojson can return is checked and a corresponding error message is returned again by getAddonInfo().
df75a1a to
c4ed95a
Compare
sounds like a good approach. |
This fixes that errors in JSON files given via
--addon=*.jsonaresilently ignored and maybe only a part of the JSON file is used.
Now the error message which picojson can return is checked and a
corresponding error message is returned again by getAddonInfo().