Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/cppcheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1985,11 +1985,11 @@ void CppCheck::analyseClangTidy(const FileSettings &fileSettings)

for (const auto& id : splitString(errorString.substr(1, errorString.length() - 2), ',')) {
errmsg.id = "clang-tidy-" + id;
if (errmsg.id.find("performance") != std::string::npos)
if (startsWith(id, "performance-"))
errmsg.severity = Severity::performance;
else if (errmsg.id.find("portability") != std::string::npos)
else if (startsWith(id, "portability-"))
errmsg.severity = Severity::portability;
else if (errmsg.id.find("cert") != std::string::npos || errmsg.id.find("misc") != std::string::npos || errmsg.id.find("unused") != std::string::npos)
else if (startsWith(id, "cert-") || startsWith(id, "misc-") || startsWith(id, "bugprone-") || (id.find("-unused-") != std::string::npos))
errmsg.severity = Severity::warning;
else
errmsg.severity = Severity::style;
Expand Down
4 changes: 2 additions & 2 deletions test/cli/other_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3464,7 +3464,7 @@ def test_clang_tidy_project(tmpdir):


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