Skip to content

Commit aab4242

Browse files
committed
add pre-commit config
1 parent 568d32e commit aab4242

File tree

3 files changed

+125
-1
lines changed

3 files changed

+125
-1
lines changed

.pre-commit.config.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
ci:
2+
autoupdate_commit_msg: "chore: update pre-commit hooks"
3+
autofix_commit_msg: "style: pre-commit fixes"
4+
5+
exclude: ^.cruft.json|.copier-answers.yml$
6+
7+
repos:
8+
- repo: https://github.com/adamchainz/blacken-docs
9+
rev: "1.18.0"
10+
hooks:
11+
- id: blacken-docs
12+
additional_dependencies: [black==24.*]
13+
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: "v5.0.0"
16+
hooks:
17+
- id: check-added-large-files
18+
- id: check-case-conflict
19+
- id: check-merge-conflict
20+
- id: check-symlinks
21+
- id: check-yaml
22+
- id: debug-statements
23+
- id: end-of-file-fixer
24+
- id: mixed-line-ending
25+
- id: name-tests-test
26+
args: ["--pytest-test-first"]
27+
- id: requirements-txt-fixer
28+
- id: trailing-whitespace
29+
30+
- repo: https://github.com/pre-commit/pygrep-hooks
31+
rev: "v1.10.0"
32+
hooks:
33+
- id: rst-backticks
34+
- id: rst-directive-colons
35+
- id: rst-inline-touching-normal
36+
37+
- repo: https://github.com/rbubley/mirrors-prettier
38+
rev: "v3.4.2"
39+
hooks:
40+
- id: prettier
41+
types_or: [yaml, markdown, html, css, scss, javascript, json]
42+
args: [--prose-wrap=always]
43+
44+
- repo: https://github.com/astral-sh/ruff-pre-commit
45+
rev: "v0.8.2"
46+
hooks:
47+
- id: ruff
48+
args: ["--fix", "--show-fixes"]
49+
- id: ruff-format
50+
51+
- repo: https://github.com/codespell-project/codespell
52+
rev: "v2.3.0"
53+
hooks:
54+
- id: codespell
55+
exclude: pixi.lock
56+
57+
- repo: https://github.com/shellcheck-py/shellcheck-py
58+
rev: "v0.10.0.1"
59+
hooks:
60+
- id: shellcheck
61+
62+
- repo: local
63+
hooks:
64+
- id: disallow-caps
65+
name: Disallow improper capitalization
66+
language: pygrep
67+
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
68+
exclude: .pre-commit-config.yaml
69+
70+
- repo: https://github.com/abravalheri/validate-pyproject
71+
rev: "v0.23"
72+
hooks:
73+
- id: validate-pyproject
74+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
75+
76+
- repo: https://github.com/python-jsonschema/check-jsonschema
77+
rev: "0.30.0"
78+
hooks:
79+
- id: check-dependabot
80+
- id: check-github-workflows

pixi.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,47 @@ default = { solve-group = "default" }
5353
dev = { features = ["dev", "tests"], solve-group = "default" }
5454
ci-py310 = ["py310", "tests"]
5555
ci-py313 = ["py313", "tests"]
56+
57+
[tool.ruff]
58+
target-version = "py310"
59+
60+
[tool.ruff.lint]
61+
extend-select = [
62+
"B", # flake8-bugbear
63+
"F", # Pyflakes
64+
"I", # isort
65+
"E", # Pycodestyle
66+
"W", # Pycodestyle
67+
"N", # pep8-naming
68+
"ARG", # flake8-unused-arguments
69+
"C4", # flake8-comprehensions
70+
"EM", # flake8-errmsg
71+
"ICN", # flake8-import-conventions
72+
"ISC", # flake8-implicit-str-concat
73+
"G", # flake8-logging-format
74+
"PGH", # pygrep-hooks
75+
"PIE", # flake8-pie
76+
"PL", # pylint
77+
"PT", # flake8-pytest-style
78+
"PTH", # flake8-use-pathlib
79+
"RET", # flake8-return
80+
"RUF", # Ruff-specific
81+
"SIM", # flake8-simplify
82+
"T20", # flake8-print
83+
"UP", # pyupgrade
84+
"YTT", # flake8-2020
85+
"EXE", # flake8-executable
86+
"NPY", # NumPy specific rules
87+
"PD", # pandas-vet
88+
"UP", # Pyupgrade
89+
]
90+
ignore = [
91+
"PLR09", # Too many <...>
92+
"PLR2004", # Magic value used in comparison
93+
"ISC001", # Conflicts with formatter
94+
"N802", # Function name should be lowercase
95+
"N806", # Variable in function should be lowercase
96+
]
97+
98+
[tool.ruff.lint.per-file-ignores]
99+
"tests/**" = ["T20"]

0 commit comments

Comments
 (0)