Skip to content

Commit fffece4

Browse files
authored
Accepting Ruff, MyPy, NumPydoc pre-commit checks (#288)
* add checks and exceptions * remove .flake8 file * add citations to ignored checks * review comments and rerun repo review * add extra links
1 parent dafcb5e commit fffece4

File tree

16 files changed

+276
-85
lines changed

16 files changed

+276
-85
lines changed

.flake8

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ assignees: ''
1313
## How To Reproduce
1414
Steps to reproduce the behaviour:
1515

16-
1.
17-
2.
18-
3.
16+
1.
17+
2.
18+
3.
1919

2020
## Expected behaviour
2121
<!-- A clear and concise description of what you expected to happen -->
2222

2323
## Screenshots
2424
<!-- If applicable, add screenshots to help explain your problem -->
2525

26-
## Environment
26+
## Environment
2727
- OS & Version: [e.g., Ubuntu 20.04 LTS]
2828
- Stratify Version
2929

.github/workflows/ci-wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
- name: "Building sdist"
7777
shell: bash
7878
run: |
79-
pipx run build --sdist
79+
pipx run build --sdist
8080
8181
- uses: actions/upload-artifact@v4
8282
with:

.github/workflows/stale.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
Otherwise this issue will be automatically closed in ${{ env.DAYS_BEFORE_CLOSE }} days time.
3939
4040
# Comment on the staled prs.
41-
stale-pr-message: |
41+
stale-pr-message: |
4242
In order to maintain a backlog of relevant PRs, we automatically label them as stale after ${{ env.DAYS_BEFORE_STALE }} days of inactivity.
4343
4444
If this PR is still important to you, then please comment on this PR and the stale label will be removed.
@@ -48,15 +48,15 @@ jobs:
4848
# Comment on the staled issues while closed.
4949
close-issue-message: |
5050
This stale issue has been automatically closed due to a lack of community activity.
51-
51+
5252
If you still care about this issue, then please either:
5353
* Re-open this issue, if you have sufficient permissions, or
5454
* Add a comment pinging `@SciTools/stratify-maintainers` who will re-open on your behalf.
5555
5656
# Comment on the staled prs while closed.
5757
close-pr-message: |
5858
This stale PR has been automatically closed due to a lack of community activity.
59-
59+
6060
If you still care about this PR, then please either:
6161
* Re-open this PR, if you have sufficient permissions, or
6262
* Add a comment pinging `@SciTools/stratify-maintainers` who will re-open on your behalf.
@@ -85,4 +85,4 @@ jobs:
8585
ascending: true
8686

8787
# Exempt all issues/prs with milestones from stale.
88-
exempt-all-milestones: true
88+
exempt-all-milestones: true

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,4 @@ dmypy.json
133133
.pyre/
134134

135135
# PyCharm
136-
.idea
136+
.idea

.pre-commit-config.yaml

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
3+
# See https://pre-commit.ci/#configuration
4+
# See https://github.com/scientific-python/cookie#sp-repo-review
35

46
ci:
5-
autoupdate_commit_msg: "chore: update pre-commit hooks"
7+
autofix_prs: false
8+
autoupdate_commit_msg: "chore: update pre-commit hooks"
69

710
repos:
811
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -18,27 +21,43 @@ repos:
1821
- id: check-merge-conflict
1922
# Check for debugger imports and py37+ `breakpoint()` calls in Python source.
2023
- id: debug-statements
24+
# Check TOML file syntax.
25+
- id: check-toml
26+
# Check YAML file syntax.
27+
- id: check-yaml
28+
# Makes sure files end in a newline and only a newline.
29+
# Duplicates Ruff W292 but also works on non-Python files.
30+
- id: end-of-file-fixer
31+
# Replaces or checks mixed line ending.
32+
- id: mixed-line-ending
2133
# Don't commit to master branch.
2234
- id: no-commit-to-branch
23-
- repo: https://github.com/psf/black-pre-commit-mirror
24-
rev: '24.10.0'
35+
# Trims trailing whitespace.
36+
# Duplicates Ruff W291 but also works on non-Python files.
37+
- id: trailing-whitespace
38+
39+
40+
- repo: https://github.com/astral-sh/ruff-pre-commit
41+
rev: "v0.7.3"
2542
hooks:
26-
- id: black
43+
- id: ruff
44+
types: [file, python]
45+
args: [--fix, --show-fixes]
46+
- id: ruff-format
2747
types: [file, python]
28-
args: [--config=./pyproject.toml, .]
29-
- repo: https://github.com/PyCQA/flake8
30-
rev: '7.1.1'
48+
49+
- repo: https://github.com/codespell-project/codespell
50+
rev: "v2.3.0"
3151
hooks:
32-
# Run flake8.
33-
- id: flake8
34-
args: [--config=./.flake8]
52+
- id: codespell
53+
types_or: [asciidoc, python, markdown, rst]
54+
additional_dependencies: [tomli]
55+
56+
57+
3558
- repo: https://github.com/pycqa/isort
3659
rev: '5.13.2'
3760
hooks:
38-
- id: isort
39-
name: isort (python)
40-
types: [file, python]
41-
args: [--filter-files]
4261
- id: isort
4362
name: isort (cython)
4463
types: [file, cython]
@@ -49,3 +68,28 @@ repos:
4968
hooks:
5069
- id: sort-all
5170
types: [file, python]
71+
72+
- repo: https://github.com/pre-commit/mirrors-mypy
73+
rev: 'v1.13.0'
74+
hooks:
75+
- id: mypy
76+
exclude: 'noxfile\.py|docs/conf\.py'
77+
78+
- repo: https://github.com/abravalheri/validate-pyproject
79+
# More exhaustive than Ruff RUF200.
80+
rev: "v0.23"
81+
hooks:
82+
- id: validate-pyproject
83+
84+
- repo: https://github.com/scientific-python/cookie
85+
rev: 2024.08.19
86+
hooks:
87+
- id: sp-repo-review
88+
additional_dependencies: ["repo-review[cli]"]
89+
args: ["--show=errskip"]
90+
91+
- repo: https://github.com/numpy/numpydoc
92+
rev: v1.8.0
93+
hooks:
94+
- id: numpydoc-validation
95+
types: [file, python]

LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
BSD 3-Clause License
2-
Copyright (c) 2015 - 2017, Met Office.
2+
Copyright (c) 2015 - 2024, Met Office.
33
All rights reserved.
44

55
Redistribution and use in source and binary forms, with or without
@@ -26,4 +26,3 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2626
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2727
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2828
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29-

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@ pip install stratify
3333

3434
## License
3535
Stratify is licenced under a [BSD 3-Clause License](LICENSE).
36-

0 commit comments

Comments
 (0)