Skip to content

Commit d1d5e59

Browse files
committed
CppCheckExecutor: report all addon loading failures at once
1 parent bcdfe90 commit d1d5e59

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cli/cppcheckexecutor.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,16 +352,18 @@ bool CppCheckExecutor::loadLibraries(Settings& settings)
352352

353353
bool CppCheckExecutor::loadAddons(Settings& settings)
354354
{
355+
bool result = true;
355356
for (const std::string &addon: settings.addons) {
356357
AddonInfo addonInfo;
357358
const std::string failedToGetAddonInfo = addonInfo.getAddonInfo(addon, settings.exename);
358359
if (!failedToGetAddonInfo.empty()) {
359360
std::cout << failedToGetAddonInfo << std::endl;
360-
return false;
361+
result = false;
362+
continue;
361363
}
362364
settings.addonInfos.emplace_back(std::move(addonInfo));
363365
}
364-
return true;
366+
return result;
365367
}
366368

367369
#ifdef _WIN32

test/cli/test-other.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ def test_invalid_library(tmpdir):
7474
# TODO: test missing std.cfg
7575

7676
def test_invalid_addon(tmpdir):
77-
args = ['--addon=misra2', 'file.c']
77+
args = ['--addon=misra3', '--addon=misra', '--addon=misra2', 'file.c']
7878

7979
exitcode, stdout, stderr = cppcheck(args)
8080
assert exitcode == 1
81-
assert stdout == '(information) Did not find addon misra2.py\n'
81+
assert (stdout == 'Did not find addon misra2.py\n'
82+
'Did not find addon misra3.py\n')
8283
assert stderr == ""

0 commit comments

Comments
 (0)