Skip to content

Commit cb99449

Browse files
authored
chore(pre-commit): replace ament linters with g++ warning-based linting
Removed ament_cppcheck and ament_cpplint hooks, added gcc-warnings hook with arguments for C/C++ files.
1 parent bd1be5d commit cb99449

File tree

1 file changed

+5
-27
lines changed

1 file changed

+5
-27
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -76,34 +76,12 @@ repos:
7676
args: [--style=file]
7777
- repo: local
7878
hooks:
79-
- id: ament_cppcheck
80-
name: ament_cppcheck
81-
description: Static code analysis of C/C++ files.
82-
entry: env AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1 ament_cppcheck
79+
- id: gcc-warnings
80+
name: gcc-warningss
8381
language: system
84-
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
85-
exclude: (^|/)(test|tests)/.* # exclude test dirs since ament_cppcheck misparses GTest macros and throws false syntax errors
86-
- repo: local
87-
hooks:
88-
- id: ament_cpplint
89-
name: ament_cpplint
90-
description: Static code analysis of C/C++ files.
91-
entry: ament_cpplint
92-
language: system
93-
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
94-
args: [
95-
"--linelength=120",
96-
"--filter=-whitespace/newline,-legal/copyright,-build/include_order" # ignore build/include_order since it conflicts with .clang-format
97-
]
98-
# CMake hooks
99-
- repo: local
100-
hooks:
101-
- id: ament_lint_cmake
102-
name: ament_lint_cmake
103-
description: Check format of CMakeLists.txt files.
104-
entry: ament_lint_cmake
105-
language: system
106-
files: CMakeLists\.txt$
82+
entry: g++
83+
args: ["-Wall", "-Wextra", "-pedantic", "-Werror", "-fsyntax-only"]
84+
files: \.(c|cc|cpp|cxx|h|hpp)$
10785
# Spellcheck in comments and docs
10886
- repo: https://github.com/codespell-project/codespell
10987
rev: v2.4.1

0 commit comments

Comments
 (0)