Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
- name: Setup Python
uses: ./.github/workflows/util/setup_python

- name: Pre-commit cache
- name: prek cache
uses: actions/cache@v6
with:
path: ~/.cache/pre-commit
key: ci-pre-commit-cache-${{ hashFiles('.pre-commit-config.yaml') }}
path: ~/.cache/prek
key: ci-prek-cache-${{ hashFiles('prek.toml') }}

- name: Run pre-commit
run: pre-commit run -v --show-diff-on-failure --color=always --all-files
- name: Run prek
run: prek run -v --show-diff-on-failure --color=always --all-files

type-check:
strategy:
Expand Down
72 changes: 0 additions & 72 deletions .pre-commit-config.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ The tests spin up a Postgres instance with Docker, so a running Docker daemon is

## Running checks locally

Run the linters with `pre-commit`:
Run the linters with `prek`:

```shell
pre-commit run -a
prek run -a
```

Run the unit tests with `pytest`:
Expand Down
1 change: 1 addition & 0 deletions linters/cspell/words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Yossi
Rozantsev
elif
pytest
prek
mypy
subclassing
typeshed
Expand Down
113 changes: 113 additions & 0 deletions prek.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
default_language_version = {python = "python3.14"}

###########
# GENERAL #
###########
[[repos]]
repo = "https://github.com/pre-commit/pre-commit-hooks"
rev = "v6.0.0"

[[repos.hooks]]
id = "check-yaml"
args = ["--unsafe"]

[[repos.hooks]]
id = "check-toml"

[[repos.hooks]]
id = "end-of-file-fixer"

[[repos.hooks]]
id = "trailing-whitespace"

[[repos.hooks]]
id = "check-added-large-files"

[[repos]]
repo = "https://github.com/streetsidesoftware/cspell-cli"
rev = "v10.0.1"

[[repos.hooks]]
id = "cspell"
exclude = '\.(csv|json|txt|lock)$'
args = [
"lint",
"-c",
"./linters/cspell.json",
"--no-progress",
"--cache",
"--cache-location",
"./linters/.cspellcache",
]

##################
# GITHUB ACTIONS #
##################
[[repos]]
repo = "https://github.com/rhysd/actionlint"
rev = "v1.7.12"

[[repos.hooks]]
id = "actionlint"

########
# TOML #
########
[[repos]]
repo = "https://github.com/pappasam/toml-sort"
rev = "v0.24.4"

[[repos.hooks]]
id = "toml-sort"
files = "pyproject.toml"
args = ["--in-place", "--ignore-case", "--trailing-comma-inline-array"]

[[repos]]
repo = "https://github.com/ComPWA/taplo-pre-commit"
rev = "v0.9.3"

[[repos.hooks]]
id = "taplo-format"
args = ["--config", "./linters/taplo.toml"]

[[repos.hooks]]
id = "taplo-lint"
args = ["--config", "./linters/taplo.toml"]

########
# YAML #
########
[[repos]]
repo = "https://github.com/adrienverge/yamllint.git"
rev = "v1.38.0"

[[repos.hooks]]
id = "yamllint"
args = ["--config-file", "./linters/yamllint.yaml"]

#######
# SQL #
#######
[[repos]]
repo = "https://github.com/darold/pgFormatter"
rev = "v5.10"

[[repos.hooks]]
id = "pg_format"
args = ["--inplace", "--wrap-limit", "120"]
files = '\.sql$'

##########
# PYTHON #
##########
[[repos]]
repo = "https://github.com/astral-sh/ruff-pre-commit"
rev = "v0.15.21"

[[repos.hooks]]
id = "ruff"
args = ["--config", "./linters/ruff.toml"]

[[repos.hooks]]
id = "ruff-format"
args = ["--config", "./linters/ruff.toml"]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ requires = ["hatchling", "hatch-vcs"]
dev = [
"httpx==0.28.1",
"mypy==2.3.0",
"pre-commit==4.6.0",
"prek==0.4.10",
"psycopg==3.3.4",
"pytest-asyncio==1.4.0",
"pytest-cov==7.1.0",
Expand Down
Loading