Skip to content

Commit ededc1d

Browse files
committed
CppCheckExecutor: report all addon loading failures at once
1 parent cbf12c8 commit ededc1d

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

cli/cppcheckexecutor.cpp

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

412412
bool CppCheckExecutor::loadAddons(Settings& settings)
413413
{
414+
bool result = true;
414415
for (const std::string &addon: settings.addons) {
415416
AddonInfo addonInfo;
416417
const std::string failedToGetAddonInfo = addonInfo.getAddonInfo(addon, settings.exename);
417418
if (!failedToGetAddonInfo.empty()) {
418419
std::cout << failedToGetAddonInfo << std::endl;
419-
return false;
420+
result = false;
421+
continue;
420422
}
421423
settings.addonInfos.emplace_back(std::move(addonInfo));
422424
}
423-
return true;
425+
return result;
424426
}
425427

426428
#ifdef _WIN32

test/cli/test-other.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,14 @@ class A {
532532

533533

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

537537
exitcode, stdout, stderr = cppcheck(args)
538538
assert exitcode == 1
539-
assert stdout == 'Did not find addon misra2.py\n'
539+
lines = stdout.splitlines()
540+
lines.sort()
541+
assert lines == [
542+
'Did not find addon misra2.py',
543+
'Did not find addon misra3.py'
544+
]
540545
assert stderr == ""

0 commit comments

Comments
 (0)