Skip to content

Commit 9d52fe2

Browse files
committed
CppCheckExecutor: report all addon loading failures at once
1 parent df57faf commit 9d52fe2

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
@@ -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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,10 @@ 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+
assert (stdout == 'Did not find addon misra2.py\n'
540+
'Did not find addon misra3.py\n')
540541
assert stderr == ""

0 commit comments

Comments
 (0)