Skip to content

Commit d6d4b70

Browse files
Move linters to pre-commit
1 parent 2953822 commit d6d4b70

File tree

16 files changed

+34
-150
lines changed

16 files changed

+34
-150
lines changed

.pre-commit-config.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,37 @@ repos:
7575
rev: v3.21.2
7676
hooks:
7777
- id: pyupgrade
78+
79+
- repo: local
80+
hooks:
81+
- id: ament_cppcheck
82+
name: ament_cppcheck
83+
description: Static code analysis of C/C++ files.
84+
entry: env AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1 ament_cppcheck
85+
language: system
86+
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
87+
- id: ament_cpplint
88+
name: ament_cpplint
89+
description: Static code analysis of C/C++ files.
90+
entry: ament_cpplint
91+
language: system
92+
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
93+
args: ["--linelength=100", "--filter=-whitespace/newline"]
94+
- id: ament_lint_cmake
95+
name: ament_lint_cmake
96+
description: Check format of CMakeLists.txt files.
97+
entry: ament_lint_cmake
98+
language: system
99+
files: CMakeLists\.txt$
100+
- id: ament_copyright
101+
name: ament_copyright
102+
description: Check if copyright notice is available in all files.
103+
entry: ament_copyright
104+
language: system
105+
exclude: .*/conf\.py$
106+
- id: ament_flake8
107+
name: ament_flake8
108+
description: Check Python code style using flake8.
109+
language: system
110+
types: [python]
111+
entry: ament_flake8

example/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ rclcpp_components_register_node(minimal_publisher
3636
)
3737

3838
if(BUILD_TESTING)
39-
find_package(ament_lint_auto REQUIRED)
40-
set(ament_cmake_cpplint_FOUND TRUE) # Conflicts with clang-foramt
41-
set(ament_cmake_flake8_FOUND TRUE) # Conflicts with black
42-
set(ament_cmake_uncrustify_FOUND TRUE) # Conflicts with clang-format
43-
ament_lint_auto_find_test_dependencies()
44-
4539
find_package(ament_cmake_gtest REQUIRED)
4640
# example_test_gtest
4741
add_rostest_with_parameters_gtest(test_example_gtest test/example_test_gtest.cpp

example/package.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020

2121
<buildtool_export_depend>ament_cmake_core</buildtool_export_depend>
2222

23-
<test_depend>ament_lint_auto</test_depend>
24-
<test_depend>ament_lint_common</test_depend>
25-
2623
<export>
2724
<build_type>ament_cmake</build_type>
2825
</export>

example_cmake_python/package.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818
<buildtool_depend>ament_cmake_python</buildtool_depend>
1919

20-
<test_depend>ament_lint_auto</test_depend>
21-
<test_depend>ament_lint_common</test_depend>
22-
2320
<export>
2421
<build_type>ament_cmake</build_type>
2522
</export>

example_external/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,4 @@ install(
5050
ament_export_targets(export_generate_parameter_library_example_external HAS_LIBRARY_TARGET)
5151
ament_export_dependencies(rclcpp rclcpp_components generate_parameter_library_example)
5252

53-
if(BUILD_TESTING)
54-
find_package(ament_lint_auto REQUIRED)
55-
set(ament_cmake_cpplint_FOUND TRUE) # Conflicts with clang-foramt
56-
set(ament_cmake_flake8_FOUND TRUE) # Conflicts with black
57-
set(ament_cmake_uncrustify_FOUND TRUE) # Conflicts with clang-format
58-
ament_lint_auto_find_test_dependencies()
59-
endif()
60-
6153
ament_package()

example_external/package.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020

2121
<buildtool_export_depend>ament_cmake_core</buildtool_export_depend>
2222

23-
<test_depend>ament_lint_auto</test_depend>
24-
<test_depend>ament_lint_common</test_depend>
25-
2623
<export>
2724
<build_type>ament_cmake</build_type>
2825
</export>

example_python/package.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
<depend>generate_parameter_library_py</depend>
1616
<depend>rclpy</depend>
1717

18-
<test_depend>ament_copyright</test_depend>
19-
<test_depend>ament_flake8</test_depend>
20-
<test_depend>ament_pep257</test_depend>
2118
<test_depend>python3-pytest</test_depend>
2219

2320
<export>

example_python/test/test_copyright.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

example_python/test/test_flake8.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

example_python/test/test_pep257.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)