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