Skip to content

Commit 569ed41

Browse files
pre-commit checks
1 parent 4da8d2d commit 569ed41

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
lines changed

.clang-format

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
BasedOnStyle: Google
3+
4+
AllowShortEnumsOnASingleLine: false
5+
AllowShortFunctionsOnASingleLine: None
6+
ColumnLimit: 140
7+
IndentWidth: 4
8+
PointerAlignment: Right
9+
SortIncludes: Never
10+
...

.github/workflows/pre-commit.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: arm64-assembly / pre-commit checks
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
pre-commit:
12+
name: Pre-commit checks
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-python@v5
17+
- name: set PY
18+
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
19+
- uses: actions/cache@v4
20+
with:
21+
path: ~/.cache/pre-commit
22+
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
23+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
exclude: |
2+
(?x)^(
3+
.*/vendor/.*|
4+
.github/CODEOWNERS
5+
)$
6+
7+
repos:
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v5.0.0
10+
hooks:
11+
- id: trailing-whitespace
12+
- id: end-of-file-fixer
13+
- id: check-yaml
14+
- id: check-added-large-files
15+
- repo: https://github.com/pre-commit/mirrors-clang-format
16+
rev: v20.1.3
17+
hooks:
18+
- id: clang-format
19+
exclude_types: [json]
20+
- repo: local
21+
hooks:
22+
- id: update-from-templates
23+
name: Check that all exercises use up-to-date copies from templates dir
24+
language: system
25+
entry: bin/update-from-templates
26+
pass_filenames: false
27+
- repo: https://github.com/astral-sh/ruff-pre-commit
28+
rev: v0.11.11
29+
hooks:
30+
- id: ruff
31+
args: [--fix]
32+
- id: ruff-format
33+
- repo: https://github.com/shellcheck-py/shellcheck-py
34+
rev: v0.10.0.1
35+
hooks:
36+
- id: shellcheck

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ Generate the test cases with the following command:
3434
./generators/generate <exercise name>
3535
```
3636

37+
## pre-commit
38+
39+
You may choose to install [pre-commit](https://pre-commit.com/) hooks using
40+
41+
```
42+
pip install pre-commit
43+
pre-commit install
44+
```
45+
3746
## Contributing Guide
3847

3948
Please see the [contributing guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).

0 commit comments

Comments
 (0)