Skip to content

Commit be576f7

Browse files
committed
Enable pre-commit & add workflow hook
1 parent c72c34a commit be576f7

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

.github/workflows/pre-commit.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: unit tests
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push: # run on every push or PR to any branch
8+
pull_request:
9+
10+
jobs:
11+
pre-commit:
12+
name: pre-commit
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.13"
22+
23+
- run: pip install pre-commit
24+
25+
- uses: actions/cache@v4
26+
with:
27+
path: ~/.cache/pre-commit
28+
key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }}
29+
30+
- run: pre-commit run --show-diff-on-failure --color=always

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
exclude: ".*/vendor/.*"
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v5.0.0
5+
hooks:
6+
- id: check-added-large-files
7+
args: ["--maxkb=128"]
8+
- id: check-ast
9+
- id: check-byte-order-marker
10+
- id: check-case-conflict
11+
- id: check-docstring-first
12+
- id: check-executables-have-shebangs
13+
- id: check-json
14+
- id: check-merge-conflict
15+
- id: check-symlinks
16+
- id: check-toml
17+
- id: check-xml
18+
- id: check-yaml
19+
- id: debug-statements
20+
- id: detect-private-key
21+
- id: end-of-file-fixer
22+
- id: mixed-line-ending
23+
args: ["--fix=lf"]
24+
- id: pretty-format-json
25+
args: ["--autofix", "--no-sort-keys", "--indent=4"]
26+
- id: trailing-whitespace
27+
28+
- repo: https://github.com/executablebooks/mdformat
29+
rev: 0.7.22
30+
hooks:
31+
- id: mdformat
32+
additional_dependencies:
33+
- mdformat-gfm
34+
35+
- repo: https://github.com/gruntwork-io/pre-commit
36+
rev: v0.1.29
37+
hooks:
38+
- id: shellcheck
39+
40+
- repo: https://github.com/astral-sh/ruff-pre-commit
41+
rev: v0.11.10
42+
hooks:
43+
- id: ruff-check
44+
args: ["--fix", "--exit-non-zero-on-fix"]
45+
- id: ruff-format

0 commit comments

Comments
 (0)