Skip to content

Commit

Permalink
Fix #12828 (cmdline: suggestion to use --checkers-report even though …
Browse files Browse the repository at this point in the history
…it is used)
  • Loading branch information
danmar committed Jul 20, 2024
1 parent 76f1aac commit 7a10718
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cli/cppcheckexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ void StdLogger::writeCheckersReport()
what = std::to_string(activeCheckers) + "/" + std::to_string(totalCheckers);
else
what = "There was critical errors";
msg.setmsg("Active checkers: " + what + " (use --checkers-report=<filename> to see details)");
if (mSettings.checkersReportFilename.empty())
what += " (use --checkers-report=<filename> to see details)";
msg.setmsg("Active checkers: " + what);

reportErr(msg);
}
Expand Down
11 changes: 11 additions & 0 deletions test/cli/other_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1752,3 +1752,14 @@ def test_lib_lookup_multi(tmpdir):
"looking for library '{}/cfg/gnu.cfg'".format(exepath),
'Checking {} ...'.format(test_file)
]


def test_checkers_report(tmpdir):
test_file = os.path.join(tmpdir, 'test.c')
with open(test_file, 'wt') as f:
f.write('x=1;')
checkers_report = os.path.join(tmpdir, 'r.txt')
exitcode, stdout, stderr, exe = cppcheck_ex(['--enable=all', '--checkers-report=' + checkers_report, test_file], remove_checkers_report=False)
assert exitcode == 0, stdout
assert 'Active checkers:' in stderr
assert '--checkers-report' not in stderr

0 comments on commit 7a10718

Please sign in to comment.