Skip to content

Commit 4054a60

Browse files
committed
Check formatting with pre-commit
1 parent feb611e commit 4054a60

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

.github/workflows/format.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This is a format job. Pre-commit has a first-party GitHub action, so we use
2+
# that: https://github.com/pre-commit/action
3+
4+
name: Format
5+
6+
on:
7+
workflow_dispatch:
8+
pull_request:
9+
push:
10+
11+
jobs:
12+
pre-commit:
13+
name: pre-commit
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-python@v2
18+
- name: Install clang-format-10
19+
run: sudo apt-get install clang-format-10
20+
- uses: rhaschke/[email protected]
21+
with:
22+
distro: melodic
23+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# To use:
2+
#
3+
# pre-commit run -a
4+
#
5+
# Or:
6+
#
7+
# pre-commit install # (runs every time you commit in git)
8+
#
9+
# To update this file:
10+
#
11+
# pre-commit autoupdate
12+
#
13+
# See https://github.com/pre-commit/pre-commit
14+
15+
repos:
16+
# Standard hooks
17+
- repo: https://github.com/pre-commit/pre-commit-hooks
18+
rev: v3.4.0
19+
hooks:
20+
- id: check-added-large-files
21+
- id: check-case-conflict
22+
- id: check-merge-conflict
23+
- id: check-symlinks
24+
- id: check-yaml
25+
- id: end-of-file-fixer
26+
- id: mixed-line-ending
27+
- id: trailing-whitespace
28+
29+
- repo: local
30+
hooks:
31+
- id: clang-format
32+
name: clang-format
33+
description: Format files with ClangFormat.
34+
entry: clang-format-10
35+
language: system
36+
files: \.(c|cc|cxx|cpp|h|hpp|hxx|ih|ispc|ipp)$
37+
args: ["-fallback-style=none", "-i"]
38+
- id: catkin_lint
39+
name: catkin_lint
40+
description: Check package.xml and cmake files
41+
entry: catkin_lint .
42+
language: system
43+
always_run: true
44+
pass_filenames: false

0 commit comments

Comments
 (0)