Interface: Tags -a, -q, -s and -v added.
This commit is contained in:
parent
ddcab63b9e
commit
cd405f4089
25
cppcheck.cpp
25
cppcheck.cpp
|
@ -65,7 +65,6 @@ void CppCheck::addFile( const std::string &path, const std::string &content )
|
||||||
std::string CppCheck::parseFromArgs( int argc, const char* const argv[] )
|
std::string CppCheck::parseFromArgs( int argc, const char* const argv[] )
|
||||||
{
|
{
|
||||||
std::vector<std::string> pathnames;
|
std::vector<std::string> pathnames;
|
||||||
bool Recursive = false;
|
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++)
|
for (int i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
|
@ -74,23 +73,19 @@ std::string CppCheck::parseFromArgs( int argc, const char* const argv[] )
|
||||||
_settings._debug = true;
|
_settings._debug = true;
|
||||||
|
|
||||||
// Show all messages
|
// Show all messages
|
||||||
else if (strcmp(argv[i],"--all") == 0)
|
else if (strcmp(argv[i],"-a") == 0 || strcmp(argv[i],"--all") == 0)
|
||||||
_settings._showAll = true;
|
_settings._showAll = true;
|
||||||
|
|
||||||
// Only print something when there are errors
|
// Only print something when there are errors
|
||||||
else if (strcmp(argv[i],"--quiet")==0)
|
else if (strcmp(argv[i],"-q")==0 || strcmp(argv[i],"--quiet")==0)
|
||||||
_settings._errorsOnly = true;
|
_settings._errorsOnly = true;
|
||||||
|
|
||||||
// Checking coding style
|
// Checking coding style
|
||||||
else if (strcmp(argv[i],"--style")==0)
|
else if (strcmp(argv[i],"-s")==0 || strcmp(argv[i],"--style")==0)
|
||||||
_settings._checkCodingStyle = true;
|
_settings._checkCodingStyle = true;
|
||||||
|
|
||||||
// Recursively check source files
|
|
||||||
else if (strcmp(argv[i],"--recursive")==0)
|
|
||||||
Recursive = true;
|
|
||||||
|
|
||||||
// Verbose error messages (configuration info)
|
// Verbose error messages (configuration info)
|
||||||
else if (strcmp(argv[i],"--verbose")==0)
|
else if (strcmp(argv[i],"-v")==0 || strcmp(argv[i],"--verbose")==0)
|
||||||
_settings._verbose = true;
|
_settings._verbose = true;
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -118,17 +113,17 @@ std::string CppCheck::parseFromArgs( int argc, const char* const argv[] )
|
||||||
"If path is given instead of filename, *.cpp, *.cxx, *.cc and *.c files are \n"
|
"If path is given instead of filename, *.cpp, *.cxx, *.cc and *.c files are \n"
|
||||||
"checked recursively from given directory.\n\n"
|
"checked recursively from given directory.\n\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
" --all Make the checking more sensitive. More bugs are detected,\n"
|
" -a, --all Make the checking more sensitive. More bugs are detected,\n"
|
||||||
" but there are also more false positives\n"
|
" but there are also more false positives\n"
|
||||||
" --errorsonly Only print error messages\n"
|
" -q, --quiet Only print error messages\n"
|
||||||
" --style Check coding style\n"
|
" -s, --style Check coding style\n"
|
||||||
" --verbose More detailed error reports\n"
|
" -v, --verbose More detailed error reports\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Example usage:\n"
|
"Example usage:\n"
|
||||||
" # Recursively check ../myproject/ and print only most fatal errors:\n"
|
" # Recursively check ../myproject/ and print only most fatal errors:\n"
|
||||||
" cppcheck --quiet ../myproject/\n"
|
" cppcheck --quiet ../myproject/\n"
|
||||||
" # Check only files one.cpp and two.cpp and give all information there is:\n"
|
" # Check only files one.cpp and two.cpp and give all information there is:\n"
|
||||||
" cppcheck --verbose --all --style one.cpp two.cpp\n";
|
" cppcheck -v -a -s one.cpp two.cpp\n";
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue