From 6c719e4b6cc674af788983851ac08f415ca3ae16 Mon Sep 17 00:00:00 2001 From: Damiano Amatruda <damiano.amatruda@skywarder.eu> Date: Sat, 11 Dec 2021 20:41:27 +0100 Subject: [PATCH] [Linter] Refine Cppcheck suppressions - Fixes Cppcheck error 'information: Unmatched suppression: unusedFunction' - Linter script no longer suppresses warning 'noExplicitConstructor' --- .pre-commit-config.yaml | 1 + sbs | 5 +++-- scripts/linter.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 65ed1c410..c4b30a4a5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,6 +14,7 @@ repos: --language=c++, --enable=all, --inline-suppr, + --suppress=unmatchedSuppression, --suppress=unusedFunction, --suppress=missingInclude ] diff --git a/sbs b/sbs index 91e2d7e1e..a87952cb6 100755 --- a/sbs +++ b/sbs @@ -232,8 +232,9 @@ lint_cppcheck() { get_cppcheck_opts opts cppcheck --language=c++ --std=c++11 --enable=all --inline-suppr \ - --suppress=unusedFunction --suppress=missingInclude \ - --error-exitcode=1 "${opts[@]}" "$source_dir/src" + --suppress=unmatchedSuppression --suppress=unusedFunction \ + --suppress=missingInclude --error-exitcode=1 "${opts[@]}" \ + "$source_dir/src" echo } diff --git a/scripts/linter.py b/scripts/linter.py index 44a7f6c84..1f6a87408 100755 --- a/scripts/linter.py +++ b/scripts/linter.py @@ -273,7 +273,7 @@ def check_cppcheck(directory): # Run cppcheck on the directory try: result = check_output(['cppcheck', '-q', '--language=c++', '--template=gcc', '--std=c++11', '--enable=all', '--inline-suppr', - '--suppress=unusedFunction', '--suppress=missingInclude', '--suppress=noExplicitConstructor', + '--suppress=unmatchedSuppression', '--suppress=unusedFunction', '--suppress=missingInclude', directory], stderr=STDOUT) # Parse results and count errors -- GitLab