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
|
// --project
|
||||||
else if (std::strncmp(argv[i], "--project=", 10) == 0) {
|
else if (std::strncmp(argv[i], "--project=", 10) == 0) {
|
||||||
mSettings->checkAllConfigurations = false; // Can be overridden with --max-configs or --force
|
mSettings->checkAllConfigurations = false; // Can be overridden with --max-configs or --force
|
||||||
|
@ -1177,7 +1184,22 @@ void CmdLineParser::printHelp()
|
||||||
" * unspecified\n"
|
" * unspecified\n"
|
||||||
" Unknown type sizes\n"
|
" Unknown type sizes\n"
|
||||||
" --plist-output=<path>\n"
|
" --plist-output=<path>\n"
|
||||||
" Generate Clang-plist output files in folder.\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"
|
" -q, --quiet Do not show progress reports.\n"
|
||||||
" -rp=<paths>, --relative-paths=<paths>\n"
|
" -rp=<paths>, --relative-paths=<paths>\n"
|
||||||
" Use relative paths in output. When given, <paths> are\n"
|
" Use relative paths in output. When given, <paths> are\n"
|
||||||
|
@ -1292,3 +1314,9 @@ void CmdLineParser::printHelp()
|
||||||
" * pcre -- rules.\n"
|
" * pcre -- rules.\n"
|
||||||
" * qt -- used in GUI\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.
|
* Print help text to the console.
|
||||||
*/
|
*/
|
||||||
static void printHelp();
|
void printHelp();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print message (to stdout).
|
* Print message (to stdout).
|
||||||
|
@ -111,6 +111,8 @@ protected:
|
||||||
static void printError(const std::string &message);
|
static void printError(const std::string &message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool isCppcheckPremium() const;
|
||||||
|
|
||||||
std::vector<std::string> mPathNames;
|
std::vector<std::string> mPathNames;
|
||||||
std::vector<std::string> mIgnoredPaths;
|
std::vector<std::string> mIgnoredPaths;
|
||||||
Settings *mSettings;
|
Settings *mSettings;
|
||||||
|
|
Loading…
Reference in New Issue