Skip to content

Commit

Permalink
Accepting Ruff, MyPy, NumPydoc pre-commit checks (#288)
Browse files Browse the repository at this point in the history
* add checks and exceptions

* remove .flake8 file

* add citations to ignored checks

* review comments and rerun repo review

* add extra links
  • Loading branch information
HGWright authored Nov 19, 2024
1 parent dafcb5e commit fffece4
Show file tree
Hide file tree
Showing 16 changed files with 276 additions and 85 deletions.
28 changes: 0 additions & 28 deletions .flake8

This file was deleted.

8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ assignees: ''
## How To Reproduce
Steps to reproduce the behaviour:

1.
2.
3.
1.
2.
3.

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

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

## Environment
## Environment
- OS & Version: [e.g., Ubuntu 20.04 LTS]
- Stratify Version

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
- name: "Building sdist"
shell: bash
run: |
pipx run build --sdist
pipx run build --sdist
- uses: actions/upload-artifact@v4
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
Otherwise this issue will be automatically closed in ${{ env.DAYS_BEFORE_CLOSE }} days time.
# Comment on the staled prs.
stale-pr-message: |
stale-pr-message: |
In order to maintain a backlog of relevant PRs, we automatically label them as stale after ${{ env.DAYS_BEFORE_STALE }} days of inactivity.
If this PR is still important to you, then please comment on this PR and the stale label will be removed.
Expand All @@ -48,15 +48,15 @@ jobs:
# Comment on the staled issues while closed.
close-issue-message: |
This stale issue has been automatically closed due to a lack of community activity.
If you still care about this issue, then please either:
* Re-open this issue, if you have sufficient permissions, or
* Add a comment pinging `@SciTools/stratify-maintainers` who will re-open on your behalf.
# Comment on the staled prs while closed.
close-pr-message: |
This stale PR has been automatically closed due to a lack of community activity.
If you still care about this PR, then please either:
* Re-open this PR, if you have sufficient permissions, or
* Add a comment pinging `@SciTools/stratify-maintainers` who will re-open on your behalf.
Expand Down Expand Up @@ -85,4 +85,4 @@ jobs:
ascending: true

# Exempt all issues/prs with milestones from stale.
exempt-all-milestones: true
exempt-all-milestones: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ dmypy.json
.pyre/

# PyCharm
.idea
.idea
72 changes: 58 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
# See https://pre-commit.ci/#configuration
# See https://github.com/scientific-python/cookie#sp-repo-review

ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_prs: false
autoupdate_commit_msg: "chore: update pre-commit hooks"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -18,27 +21,43 @@ repos:
- id: check-merge-conflict
# Check for debugger imports and py37+ `breakpoint()` calls in Python source.
- id: debug-statements
# Check TOML file syntax.
- id: check-toml
# Check YAML file syntax.
- id: check-yaml
# Makes sure files end in a newline and only a newline.
# Duplicates Ruff W292 but also works on non-Python files.
- id: end-of-file-fixer
# Replaces or checks mixed line ending.
- id: mixed-line-ending
# Don't commit to master branch.
- id: no-commit-to-branch
- repo: https://github.com/psf/black-pre-commit-mirror
rev: '24.10.0'
# Trims trailing whitespace.
# Duplicates Ruff W291 but also works on non-Python files.
- id: trailing-whitespace


- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.7.3"
hooks:
- id: black
- id: ruff
types: [file, python]
args: [--fix, --show-fixes]
- id: ruff-format
types: [file, python]
args: [--config=./pyproject.toml, .]
- repo: https://github.com/PyCQA/flake8
rev: '7.1.1'

- repo: https://github.com/codespell-project/codespell
rev: "v2.3.0"
hooks:
# Run flake8.
- id: flake8
args: [--config=./.flake8]
- id: codespell
types_or: [asciidoc, python, markdown, rst]
additional_dependencies: [tomli]



- repo: https://github.com/pycqa/isort
rev: '5.13.2'
hooks:
- id: isort
name: isort (python)
types: [file, python]
args: [--filter-files]
- id: isort
name: isort (cython)
types: [file, cython]
Expand All @@ -49,3 +68,28 @@ repos:
hooks:
- id: sort-all
types: [file, python]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.13.0'
hooks:
- id: mypy
exclude: 'noxfile\.py|docs/conf\.py'

- repo: https://github.com/abravalheri/validate-pyproject
# More exhaustive than Ruff RUF200.
rev: "v0.23"
hooks:
- id: validate-pyproject

- repo: https://github.com/scientific-python/cookie
rev: 2024.08.19
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
args: ["--show=errskip"]

- repo: https://github.com/numpy/numpydoc
rev: v1.8.0
hooks:
- id: numpydoc-validation
types: [file, python]
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BSD 3-Clause License
Copyright (c) 2015 - 2017, Met Office.
Copyright (c) 2015 - 2024, Met Office.
All rights reserved.

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

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ pip install stratify

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

Loading

0 comments on commit fffece4

Please sign in to comment.