cli: if cppcheck premium edition is executed then allow a special option --premium=<option> also
This commit is contained in:
parent
19e9712762
commit
8c0dfea472
|
@ -608,6 +608,13 @@ bool CmdLineParser::parseFromArgs(int argc, const char* const argv[])
|
|||
}
|
||||
}
|
||||
|
||||
// Special Cppcheck Premium options
|
||||
else if (std::strncmp(argv[i], "--premium=", 10) == 0 && isCppcheckPremium()) {
|
||||
if (!mSettings->premiumArgs.size())
|
||||
mSettings->premiumArgs += " ";
|
||||
mSettings->premiumArgs += "--" + std::string(argv[i] + 10);
|
||||
}
|
||||
|
||||
// --project
|
||||
else if (std::strncmp(argv[i], "--project=", 10) == 0) {
|
||||
mSettings->checkAllConfigurations = false; // Can be overridden with --max-configs or --force
|
||||
|
@ -1177,17 +1184,32 @@ void CmdLineParser::printHelp()
|
|||
" * unspecified\n"
|
||||
" Unknown type sizes\n"
|
||||
" --plist-output=<path>\n"
|
||||
" Generate Clang-plist output files in folder.\n"
|
||||
" -q, --quiet Do not show progress reports.\n"
|
||||
" -rp=<paths>, --relative-paths=<paths>\n"
|
||||
" Use relative paths in output. When given, <paths> are\n"
|
||||
" used as base. You can separate multiple paths by ';'.\n"
|
||||
" Otherwise path where source files are searched is used.\n"
|
||||
" We use string comparison to create relative paths, so\n"
|
||||
" using e.g. ~ for home folder does not work. It is\n"
|
||||
" currently only possible to apply the base paths to\n"
|
||||
" files that are on a lower level in the directory tree.\n"
|
||||
" --report-progress Report progress messages while checking a file.\n"
|
||||
" Generate Clang-plist output files in folder.\n";
|
||||
|
||||
if (isCppcheckPremium()) {
|
||||
std::cout << " --premium=<option>\n"
|
||||
<< " Coding standards:\n"
|
||||
<< " * autosar Autosar (partial)\n"
|
||||
<< " * cert-c-2016 Cert C 2016 checking\n"
|
||||
<< " * cert-c++-2016 Cert C++ 2016 checking (partial)\n"
|
||||
<< " * misra-c-2012 Misra C 2012\n"
|
||||
<< " * misra-c++-2008 Misra C++ 2008 (partial)\n"
|
||||
<< " Other:\n"
|
||||
<< " * bughunting Soundy analysis\n"
|
||||
<< " * cert-c-int-precision=BITS integer precision to use in Cert C analysis.\n";
|
||||
}
|
||||
|
||||
std::cout <<
|
||||
" -q, --quiet Do not show progress reports.\n"
|
||||
" -rp=<paths>, --relative-paths=<paths>\n"
|
||||
" Use relative paths in output. When given, <paths> are\n"
|
||||
" used as base. You can separate multiple paths by ';'.\n"
|
||||
" Otherwise path where source files are searched is used.\n"
|
||||
" We use string comparison to create relative paths, so\n"
|
||||
" using e.g. ~ for home folder does not work. It is\n"
|
||||
" currently only possible to apply the base paths to\n"
|
||||
" files that are on a lower level in the directory tree.\n"
|
||||
" --report-progress Report progress messages while checking a file.\n"
|
||||
#ifdef HAVE_RULES
|
||||
" --rule=<rule> Match regular expression.\n"
|
||||
" --rule-file=<file> Use given rule file. For more information, see:\n"
|
||||
|
@ -1292,3 +1314,9 @@ void CmdLineParser::printHelp()
|
|||
" * pcre -- rules.\n"
|
||||
" * qt -- used in GUI\n";
|
||||
}
|
||||
|
||||
bool CmdLineParser::isCppcheckPremium() const {
|
||||
if (mSettings->cppcheckCfgProductName.empty())
|
||||
mSettings->loadCppcheckCfg();
|
||||
return mSettings->cppcheckCfgProductName.compare(0, 16, "Cppcheck Premium") == 0;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ protected:
|
|||
/**
|
||||
* Print help text to the console.
|
||||
*/
|
||||
static void printHelp();
|
||||
void printHelp();
|
||||
|
||||
/**
|
||||
* Print message (to stdout).
|
||||
|
@ -111,6 +111,8 @@ protected:
|
|||
static void printError(const std::string &message);
|
||||
|
||||
private:
|
||||
bool isCppcheckPremium() const;
|
||||
|
||||
std::vector<std::string> mPathNames;
|
||||
std::vector<std::string> mIgnoredPaths;
|
||||
Settings *mSettings;
|
||||
|
|
Loading…
Reference in New Issue