Skip to content

Commit

Permalink
CppCheckExecutor: report all addon loading failures at once
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed Oct 5, 2023
1 parent be1006b commit fa081bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 4 additions & 2 deletions cli/cppcheckexecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,16 +411,18 @@ bool CppCheckExecutor::loadLibraries(Settings& settings)

bool CppCheckExecutor::loadAddons(Settings& settings)
{
bool result = true;
for (const std::string &addon: settings.addons) {
AddonInfo addonInfo;
const std::string failedToGetAddonInfo = addonInfo.getAddonInfo(addon, settings.exename);
if (!failedToGetAddonInfo.empty()) {
std::cout << failedToGetAddonInfo << std::endl;
return false;
result = false;
continue;
}
settings.addonInfos.emplace_back(std::move(addonInfo));
}
return true;
return result;
}

#ifdef _WIN32
Expand Down
9 changes: 7 additions & 2 deletions test/cli/test-other.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,14 @@ def test_showtime_top5_file(tmpdir):


def test_missing_addon(tmpdir):
args = ['--addon=misra2', 'file.c']
args = ['--addon=misra3', '--addon=misra', '--addon=misra2', 'file.c']

exitcode, stdout, stderr = cppcheck(args)
assert exitcode == 1
assert stdout == 'Did not find addon misra2.py\n'
lines = stdout.splitlines()
lines.sort()
assert lines == [
'Did not find addon misra2.py',
'Did not find addon misra3.py'
]
assert stderr == ""

0 comments on commit fa081bd

Please sign in to comment.