Skip to content

Commit b117f26

Browse files
Sourcery as a pre-commit hook
1 parent d731a99 commit b117f26

File tree

2 files changed

+139
-52
lines changed

2 files changed

+139
-52
lines changed

.pre-commit-config.yaml

Lines changed: 57 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,63 @@
11
ci:
2-
autoupdate_commit_msg: "chore: update pre-commit hooks"
3-
autoupdate_schedule: "monthly"
4-
autofix_commit_msg: "style: pre-commit fixes"
2+
autoupdate_commit_msg: 'chore: update pre-commit hooks'
3+
autoupdate_schedule: monthly
4+
autofix_commit_msg: 'style: pre-commit fixes'
55
autofix_prs: false
66
default_stages: [pre-commit, pre-push]
77
repos:
8-
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.11.9
10-
hooks:
11-
- id: ruff
12-
args: ["--fix", "--show-fixes"]
13-
- id: ruff-format
14-
- repo: https://github.com/codespell-project/codespell
15-
rev: v2.4.1
16-
hooks:
17-
- id: codespell
18-
args: ["-L", "fo,ihs,kake,te", "-S", "fixture"]
19-
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: v5.0.0
21-
hooks:
22-
- id: check-yaml
23-
- id: trailing-whitespace
24-
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.15.0
26-
hooks:
27-
- id: mypy
28-
files: src|tests
29-
additional_dependencies:
8+
- repo: https://github.com/astral-sh/ruff-pre-commit
9+
rev: v0.11.9
10+
hooks:
11+
- id: ruff
12+
args: [--fix, --show-fixes]
13+
- id: ruff-format
14+
- repo: https://github.com/sourcery-ai/sourcery
15+
rev: v1.37.0
16+
hooks:
17+
- id: sourcery
18+
args: [--diff=git diff HEAD, --no-summary]
19+
- repo: https://github.com/codespell-project/codespell
20+
rev: v2.4.1
21+
hooks:
22+
- id: codespell
23+
args: [-L, 'fo,ihs,kake,te', -S, fixture]
24+
- repo: https://github.com/pre-commit/pre-commit-hooks
25+
rev: v5.0.0
26+
hooks:
27+
- id: check-yaml
28+
- id: trailing-whitespace
29+
- repo: https://github.com/pre-commit/mirrors-mypy
30+
rev: v1.15.0
31+
hooks:
32+
- id: mypy
33+
files: src|tests
34+
additional_dependencies:
3035
# Package dependencies
31-
- packaging
32-
- donfig
33-
- numcodecs[crc32c]
34-
- numpy==2.1 # until https://github.com/numpy/numpy/issues/28034 is resolved
35-
- typing_extensions
36-
- universal-pathlib
37-
- obstore>=0.5.1
36+
- packaging
37+
- donfig
38+
- numcodecs[crc32c]
39+
- numpy==2.1 # until https://github.com/numpy/numpy/issues/28034 is resolved
40+
- typing_extensions
41+
- universal-pathlib
42+
- obstore>=0.5.1
3843
# Tests
39-
- pytest
40-
- hypothesis
41-
- s3fs
42-
- repo: https://github.com/scientific-python/cookie
43-
rev: 2025.05.02
44-
hooks:
45-
- id: sp-repo-review
46-
- repo: https://github.com/pre-commit/pygrep-hooks
47-
rev: v1.10.0
48-
hooks:
49-
- id: rst-directive-colons
50-
- id: rst-inline-touching-normal
51-
- repo: https://github.com/numpy/numpydoc
52-
rev: v1.8.0
53-
hooks:
54-
- id: numpydoc-validation
55-
- repo: https://github.com/twisted/towncrier
56-
rev: 24.8.0
57-
hooks:
58-
- id: towncrier-check
44+
- pytest
45+
- hypothesis
46+
- s3fs
47+
- repo: https://github.com/scientific-python/cookie
48+
rev: 2025.05.02
49+
hooks:
50+
- id: sp-repo-review
51+
- repo: https://github.com/pre-commit/pygrep-hooks
52+
rev: v1.10.0
53+
hooks:
54+
- id: rst-directive-colons
55+
- id: rst-inline-touching-normal
56+
- repo: https://github.com/numpy/numpydoc
57+
rev: v1.8.0
58+
hooks:
59+
- id: numpydoc-validation
60+
- repo: https://github.com/twisted/towncrier
61+
rev: 24.8.0
62+
hooks:
63+
- id: towncrier-check

.sourcery.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# 🪄 This is your project's Sourcery configuration file.
2+
3+
# You can use it to get Sourcery working in the way you want, such as
4+
# ignoring specific refactorings, skipping directories in your project,
5+
# or writing custom rules.
6+
7+
# 📚 For a complete reference to this file, see the documentation at
8+
# https://docs.sourcery.ai/Configuration/Project-Settings/
9+
10+
# This file was auto-generated by Sourcery on 2025-06-20 at 14:38.
11+
12+
version: '1' # The schema version of this config file
13+
14+
ignore: # A list of paths or files which Sourcery will ignore.
15+
- .git
16+
- env
17+
- .env
18+
- .tox
19+
- node_modules
20+
- vendor
21+
- venv
22+
- .venv
23+
- ~/.pyenv
24+
- ~/.rye
25+
- ~/.vscode
26+
- .vscode
27+
- ~/.cache
28+
- ~/.config
29+
- ~/.local
30+
31+
rule_settings:
32+
enable:
33+
- default
34+
disable: [] # A list of rule IDs Sourcery will never suggest.
35+
rule_types:
36+
- refactoring
37+
- suggestion
38+
- comment
39+
python_version: '3.11' # A string specifying the lowest Python version your project supports. Sourcery will not suggest refactorings requiring a higher Python version.
40+
41+
# rules: # A list of custom rules Sourcery will include in its analysis.
42+
# - id: no-print-statements
43+
# description: Do not use print statements in the test directory.
44+
# pattern: print(...)
45+
# language: python
46+
# replacement:
47+
# condition:
48+
# explanation:
49+
# paths:
50+
# include:
51+
# - test
52+
# exclude:
53+
# - conftest.py
54+
# tests: []
55+
# tags: []
56+
57+
# rule_tags: {} # Additional rule tags.
58+
59+
# metrics:
60+
# quality_threshold: 25.0
61+
62+
# github:
63+
# labels: []
64+
# ignore_labels:
65+
# - sourcery-ignore
66+
# request_review: author
67+
# sourcery_branch: sourcery/{base_branch}
68+
69+
# clone_detection:
70+
# min_lines: 3
71+
# min_duplicates: 2
72+
# identical_clones_only: false
73+
74+
# proxy:
75+
# url:
76+
# ssl_certs_file:
77+
# no_ssl_verify: false
78+
79+
# coding_assistant:
80+
# project_description: ''
81+
# enabled: true
82+
# recipe_prompts: {}

0 commit comments

Comments
 (0)