Added command line option --report-progress. ticket: #1926
This commit is contained in:
parent
a6be941006
commit
6cb7fefdbf
|
@ -25,7 +25,7 @@
|
|||
|
||||
CppCheckExecutor::CppCheckExecutor()
|
||||
{
|
||||
time1 = std::time(0);
|
||||
time1 = 0;
|
||||
}
|
||||
|
||||
CppCheckExecutor::~CppCheckExecutor()
|
||||
|
@ -41,6 +41,9 @@ int CppCheckExecutor::check(int argc, const char* const argv[])
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (cppCheck.settings().reportProgress)
|
||||
time1 = std::time(0);
|
||||
|
||||
_settings = cppCheck.settings();
|
||||
if (_settings._xml)
|
||||
{
|
||||
|
@ -91,6 +94,9 @@ void CppCheckExecutor::reportProgress(const std::string &filename, const char st
|
|||
{
|
||||
(void)filename;
|
||||
|
||||
if (!time1)
|
||||
return;
|
||||
|
||||
// Report progress messages every 10 seconds
|
||||
const std::time_t time2 = std::time(NULL);
|
||||
if (time2 >= (time1 + 10))
|
||||
|
|
|
@ -444,6 +444,12 @@ bool CppCheck::parseFromArgs(int argc, const char* const argv[])
|
|||
AddFilesToList(12 + argv[i], pathnames);
|
||||
}
|
||||
|
||||
// Report progress
|
||||
else if (strcmp(argv[i], "--report-progress") == 0)
|
||||
{
|
||||
_settings.reportProgress = true;
|
||||
}
|
||||
|
||||
// Output formatter
|
||||
else if (strcmp(argv[i], "--template") == 0)
|
||||
{
|
||||
|
@ -577,9 +583,9 @@ bool CppCheck::parseFromArgs(int argc, const char* const argv[])
|
|||
"Syntax:\n"
|
||||
" cppcheck [--append=file] [-D<ID>] [--enable=<id>] [--error-exitcode=[n]]\n"
|
||||
" [--exitcode-suppressions file] [--file-list=file.txt] [--force]\n"
|
||||
" [--help] [-Idir] [--inline-suppr] [-j [jobs]] [--quiet] [--style]\n"
|
||||
" [--suppressions file.txt] [--verbose] [--version] [--xml]\n"
|
||||
" [file or path1] [file or path] ..\n"
|
||||
" [--help] [-Idir] [--inline-suppr] [-j [jobs]] [--quiet]\n"
|
||||
" [--report-progress] [--style] [--suppressions file.txt]\n"
|
||||
" [--verbose] [--version] [--xml] [file or path1] [file or path]\n"
|
||||
"\n"
|
||||
"If path is given instead of filename, *.cpp, *.cxx, *.cc, *.c++ and *.c files\n"
|
||||
"are checked recursively from given directory.\n\n"
|
||||
|
@ -617,6 +623,7 @@ bool CppCheck::parseFromArgs(int argc, const char* const argv[])
|
|||
" on the lines before the warning to suppress.\n"
|
||||
" -j [jobs] Start [jobs] threads to do the checking simultaneously.\n"
|
||||
" -q, --quiet Only print error messages\n"
|
||||
" --report-progress Report progress messages while checking a file.\n"
|
||||
" -s, --style deprecated, use --enable=style\n"
|
||||
" --suppressions file Suppress warnings listed in the file. Filename and line\n"
|
||||
" are optional. The format of the single line in file is:\n"
|
||||
|
|
|
@ -42,6 +42,7 @@ Settings::Settings()
|
|||
_terminate = false;
|
||||
inconclusive = false;
|
||||
test_2_pass = false;
|
||||
reportProgress = false;
|
||||
ifcfg = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,6 +171,9 @@ public:
|
|||
/** @brief Experimentat 2 pass checking of files */
|
||||
bool test_2_pass;
|
||||
|
||||
/** @brief --report-progress */
|
||||
bool reportProgress;
|
||||
|
||||
/**
|
||||
* @brief Is there any #if configurations in the source code?
|
||||
* As usual, include guards are not counted.
|
||||
|
|
|
@ -114,6 +114,7 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
|
|||
<arg choice="opt"><option>--inline-suppr</option></arg>
|
||||
<arg choice="opt"><option>-j[jobs]</option></arg>
|
||||
<arg choice="opt"><option>--quiet</option></arg>
|
||||
<arg choice="opt"><option>--report-progress</option></arg>
|
||||
<arg choice="opt"><option>--style</option></arg>
|
||||
<arg choice="opt"><option>--suppressions [file]</option></arg>
|
||||
<arg choice="opt"><option>--template '[text]'</option></arg>
|
||||
|
@ -256,6 +257,12 @@ files, this is not needed.</para>
|
|||
<para>Only print something when there is an error.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--report-progress</option></term>
|
||||
<listitem>
|
||||
<para>Report progress when checking a file.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-s</option></term>
|
||||
<term><option>--style</option></term>
|
||||
|
|
Loading…
Reference in New Issue