Skip to content

Commit e76ec8d

Browse files
authored
fixed #13829 - mapped bugprone-* clang-tidy findings to warning (danmar#7503)
1 parent 3d59c29 commit e76ec8d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/cppcheck.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,11 +1985,11 @@ void CppCheck::analyseClangTidy(const FileSettings &fileSettings)
19851985

19861986
for (const auto& id : splitString(errorString.substr(1, errorString.length() - 2), ',')) {
19871987
errmsg.id = "clang-tidy-" + id;
1988-
if (errmsg.id.find("performance") != std::string::npos)
1988+
if (startsWith(id, "performance-"))
19891989
errmsg.severity = Severity::performance;
1990-
else if (errmsg.id.find("portability") != std::string::npos)
1990+
else if (startsWith(id, "portability-"))
19911991
errmsg.severity = Severity::portability;
1992-
else if (errmsg.id.find("cert") != std::string::npos || errmsg.id.find("misc") != std::string::npos || errmsg.id.find("unused") != std::string::npos)
1992+
else if (startsWith(id, "cert-") || startsWith(id, "misc-") || startsWith(id, "bugprone-") || (id.find("-unused-") != std::string::npos))
19931993
errmsg.severity = Severity::warning;
19941994
else
19951995
errmsg.severity = Severity::style;

test/cli/other_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3464,7 +3464,7 @@ def test_clang_tidy_project(tmpdir):
34643464

34653465

34663466
@pytest.mark.skipif(not has_clang_tidy, reason='clang-tidy is not available')
3467-
def test_clang_tidy_error_exit(tmp_path): # #13828
3467+
def test_clang_tidy_error_exit(tmp_path): # #13828 / #13829
34683468
test_file = tmp_path / 'test.cpp'
34693469
with open(test_file, 'wt') as f:
34703470
f.write(
@@ -3495,7 +3495,7 @@ def test_clang_tidy_error_exit(tmp_path): # #13828
34953495
exitcode, stdout, stderr = cppcheck(args)
34963496
assert stdout.splitlines() == []
34973497
assert stderr.splitlines() == [
3498-
"{}:10:12: style: 'str' used after it was moved [clang-tidy-bugprone-use-after-move]".format(test_file),
3498+
"{}:10:12: warning: 'str' used after it was moved [clang-tidy-bugprone-use-after-move]".format(test_file),
34993499
"{}:10:12: style: 'str' used after it was moved [clang-tidy-hicpp-invalid-access-moved]".format(test_file)
35003500
]
35013501
assert exitcode == 0, stdout

0 commit comments

Comments
 (0)