Skip to content

Commit 4284764

Browse files
Use pre-commit workflow and update settings
1 parent 48cf81d commit 4284764

6 files changed

+71
-83
lines changed

.github/workflows/ci-format.yml

-23
This file was deleted.

.github/workflows/ci-pre-commit.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Pre-Commit
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- master
8+
9+
jobs:
10+
pre-commit:
11+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
ROS_DISTRO: [rolling, iron]
16+
with:
17+
ros_distro: ${{ matrix.ROS_DISTRO }}
18+
os_name: ubuntu-22.04

.github/workflows/ci-ros-lint.yml

-44
This file was deleted.
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Humble Pre-Commit
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- humble
8+
9+
jobs:
10+
pre-commit:
11+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-pre-commit.yml@master
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
ROS_DISTRO: [humble]
16+
with:
17+
ros_distro: ${{ matrix.ROS_DISTRO }}
18+
os_name: ubuntu-22.04
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Auto Update pre-commit
2+
# Update pre-commit config and create PR if changes are detected
3+
# author: Christoph Fröhlich <[email protected]>
4+
5+
on:
6+
workflow_dispatch:
7+
schedule:
8+
- cron: '0 0 * * 0' # Run every Sunday at midnight
9+
10+
jobs:
11+
auto_update_and_create_pr:
12+
uses: ros-controls/ros2_control_ci/.github/workflows/reusable-update-pre-commit.yml@master

.pre-commit-config.yaml

+23-16
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
repos:
1717
# Standard hooks
1818
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
rev: v4.4.0
19+
rev: v4.5.0
2020
hooks:
2121
- id: check-added-large-files
2222
- id: check-ast
@@ -36,7 +36,7 @@ repos:
3636

3737
# Python hooks
3838
- repo: https://github.com/asottile/pyupgrade
39-
rev: v3.4.0
39+
rev: v3.15.1
4040
hooks:
4141
- id: pyupgrade
4242
args: [--py36-plus]
@@ -48,40 +48,39 @@ repos:
4848
- id: pydocstyle
4949
args: ["--ignore=D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404"]
5050

51+
- repo: https://github.com/psf/black
52+
rev: 24.2.0
53+
hooks:
54+
- id: black
55+
args: ["--line-length=99"]
56+
5157
- repo: https://github.com/pycqa/flake8
52-
rev: 6.0.0
58+
rev: 7.0.0
5359
hooks:
5460
- id: flake8
5561
args: ["--extend-ignore=E501"]
5662

5763
# CPP hooks
58-
- repo: local
64+
- repo: https://github.com/pre-commit/mirrors-clang-format
65+
rev: v17.0.6
5966
hooks:
6067
- id: clang-format
61-
name: clang-format
62-
description: Format files with ClangFormat.
63-
entry: clang-format-14
64-
language: system
65-
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$
6668
args: ['-fallback-style=none', '-i']
6769

6870
- repo: local
6971
hooks:
7072
- id: ament_cppcheck
7173
name: ament_cppcheck
7274
description: Static code analysis of C/C++ files.
73-
stages: [commit]
74-
entry: ament_cppcheck
75+
entry: env AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1 ament_cppcheck
7576
language: system
7677
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
7778

78-
# Maybe use https://github.com/cpplint/cpplint instead
7979
- repo: local
8080
hooks:
8181
- id: ament_cpplint
8282
name: ament_cpplint
8383
description: Static code analysis of C/C++ files.
84-
stages: [commit]
8584
entry: ament_cpplint
8685
language: system
8786
files: \.(h\+\+|h|hh|hxx|hpp|cuh|c|cc|cpp|cu|c\+\+|cxx|tpp|txx)$
@@ -93,7 +92,6 @@ repos:
9392
- id: ament_lint_cmake
9493
name: ament_lint_cmake
9594
description: Check format of CMakeLists.txt files.
96-
stages: [commit]
9795
entry: ament_lint_cmake
9896
language: system
9997
files: CMakeLists\.txt$
@@ -104,7 +102,6 @@ repos:
104102
- id: ament_copyright
105103
name: ament_copyright
106104
description: Check if copyright notice is available in all files.
107-
stages: [commit]
108105
entry: ament_copyright
109106
language: system
110107

@@ -127,8 +124,18 @@ repos:
127124
# Spellcheck in comments and docs
128125
# skipping of *.svg files is not working...
129126
- repo: https://github.com/codespell-project/codespell
130-
rev: v2.2.4
127+
rev: v2.2.6
131128
hooks:
132129
- id: codespell
133130
args: ['--write-changes']
134131
exclude: CHANGELOG\.rst|\.(svg|pyc)$
132+
133+
- repo: https://github.com/python-jsonschema/check-jsonschema
134+
rev: 0.28.0
135+
hooks:
136+
- id: check-github-workflows
137+
args: ["--verbose"]
138+
- id: check-github-actions
139+
args: ["--verbose"]
140+
- id: check-dependabot
141+
args: ["--verbose"]

0 commit comments

Comments
 (0)