Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cf-units] Ruff fixes #527

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
68c040e
Added extra pre-commit default hooks
ukmo-ccbunney Nov 12, 2024
b069221
Added codespell pre-commit hook
ukmo-ccbunney Nov 12, 2024
b46036f
Added mypy and configuration
ukmo-ccbunney Nov 13, 2024
6b8f31f
Added mypy exrts dependency
ukmo-ccbunney Nov 14, 2024
344d820
Added ignores for mypy (including one in sp-repo-review)
ukmo-ccbunney Nov 14, 2024
95192b5
Added validate-pyproject
ukmo-ccbunney Nov 14, 2024
2a80095
Added numpydoc precommit hook and ignored errors in pyproject.toml
ukmo-ccbunney Nov 14, 2024
f9902a1
Updated ignore_list of sp-repo-review for errors that have been
ukmo-ccbunney Nov 14, 2024
9e082df
Fixed sp-repo-review "PC901" (Custom pre-commit CI message)
ukmo-ccbunney Nov 14, 2024
c13d29d
Added extra pytest config, as recommended by sp-repo-review.
ukmo-ccbunney Nov 14, 2024
edba9c2
Added `filterwarnings=error` option for pytest and an exception for thie
ukmo-ccbunney Nov 14, 2024
18f934f
- Enabled all Ruff checks.
ukmo-ccbunney Nov 15, 2024
bf35397
Tidy up pyproject.toml.
ukmo-ccbunney Nov 15, 2024
0a10cab
Updated Ruff config:
ukmo-ccbunney Nov 15, 2024
7fc50ed
Auto-corrections for
ukmo-ccbunney Nov 15, 2024
1e98bb5
- Update Ruff version.
ukmo-ccbunney Nov 15, 2024
b59fca0
Try different approach to MyPy ignore files in .pre-commit config
ukmo-ccbunney Nov 15, 2024
f014c41
Update pyproject.toml
ukmo-ccbunney Nov 16, 2024
7e9a9bb
Update pyproject.toml
ukmo-ccbunney Nov 17, 2024
89afe5a
Roll back changes to _antlr4_runtime and add .pre-commit exclusion for
ukmo-ccbunney Nov 19, 2024
2749787
Added reference comment to .pre-commit-config.yaml
ukmo-ccbunney Nov 19, 2024
843e6c2
Removed redundant setting
ukmo-ccbunney Nov 19, 2024
5a955ff
Removed comment
ukmo-ccbunney Nov 19, 2024
01fe1b7
Alphabetise repo-review ignore list
ukmo-ccbunney Nov 19, 2024
d831bfb
Ahphabetised pre-commit hooks, as per template
ukmo-ccbunney Nov 19, 2024
43edd4b
Merge branch 'main' into qa_reresh_pre-commit-hooks
ukmo-ccbunney Nov 19, 2024
9ab7ec3
Added explanation comments to Ruff ignores
ukmo-ccbunney Nov 19, 2024
2fc5e4f
Address Ruff A001 errors
ukmo-ccbunney Nov 19, 2024
dcaefcd
Address D301 - Use `r"""` if any backslashes in a docstring
ukmo-ccbunney Nov 19, 2024
c8f90b8
Addressed D404 docstring-starts-with-this
ukmo-ccbunney Nov 19, 2024
6f01fac
Fixes for "D401", # non-imperative-mood
ukmo-ccbunney Nov 19, 2024
f7281a5
Addressed "FBT002", # boolean-default-value-positional-argument.
ukmo-ccbunney Nov 19, 2024
d57a90c
Added noqa exception for FLY002 - alternatives are not great:
ukmo-ccbunney Nov 19, 2024
2f6736e
Fixes: "EM101" raw-string-in-exception
ukmo-ccbunney Nov 19, 2024
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
2 changes: 1 addition & 1 deletion .git_archival.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true)$
ref-names: $Format:%D$
ref-names: $Format:%D$
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Submitting changes

1. Push your branch to your fork of cf-units.
1. Submit your pull request.
1. Note that all authors on pull requests will automatically be asked to sign the
1. Note that all authors on pull requests will automatically be asked to sign the
[SciTools Contributor Licence Agreement](https://cla-assistant.io/SciTools/)
(CLA), if they have not already done so.
(CLA), if they have not already done so.
1. Chillax!

If in doubt, please post in the
[cf-units Discussions space](https://github.com/SciTools/cf-units/discussions)
[cf-units Discussions space](https://github.com/SciTools/cf-units/discussions)
and we'll be happy to help you.
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,14 +13,14 @@ 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 -->

## Environment
## Environment
- OS & Version: [e.g., Ubuntu 20.04 LTS]
- cf-units Version: [e.g., From the command line run `python -c "import cf_units; print(cf_units.__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 @@ -104,7 +104,7 @@ jobs:
- name: "Building sdist"
shell: bash
run: |
pipx run build --sdist
pipx run build --sdist

- uses: actions/upload-artifact@v4
with:
Expand Down
75 changes: 63 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
# 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 for repo-review

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

exclude: 'cf_units/_udunits2_parser/_antlr4_runtime/'

minimum_pre_commit_version: 1.21.0

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
Expand All @@ -16,28 +25,51 @@ 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 main branch.
- id: no-commit-to-branch
# Trims trailing whitespace.
# Duplicates Ruff W291 but also works on non-Python files.
- id: trailing-whitespace

- repo: https://github.com/aio-libs/sort-all
rev: v1.3.0
hooks:
- id: sort-all
types: [file, python]

- repo: https://github.com/scientific-python/cookie
rev: 2024.08.19
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"] # TODO: Only neededed if extra dependencies are required
#args: ["--show=errskip"] # show everything for the moment
# Hooks from all other repos
# NOTE : keep these in hook-name (aka 'id') order

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.19.1
hooks:
- id: blacken-docs
types: [file, rst]

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

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.13.0'
hooks:
- id: mypy
additional_dependencies:
- 'types-requests'
exclude: 'docs/|cf_units/_udunits2_parser/parser/.*\.py|cf_units/_udunits2_parser/_antlr4_runtime/.*\.py'

- repo: https://github.com/numpy/numpydoc
rev: v1.8.0
hooks:
- id: numpydoc-validation
types: [file, python]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.7.4"
hooks:
Expand All @@ -47,3 +79,22 @@ repos:
args: [--fix, --show-fixes]
# Run the formatter.
- id: ruff-format

- repo: https://github.com/aio-libs/sort-all
rev: v1.3.0
hooks:
- id: sort-all
types: [file, python]

- repo: https://github.com/scientific-python/cookie
rev: 2024.08.19
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"] # TODO: Only neededed if extra dependencies are required
#args: ["--show=errskip"] # show everything for the moment

- repo: https://github.com/abravalheri/validate-pyproject
# More exhaustive than Ruff RUF200.
rev: "v0.23"
hooks:
- id: validate-pyproject
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ recursive-include requirements *
recursive-include docs *
prune docs/build

exclude cf_units/etc/site.cfg
exclude cf_units/etc/site.cfg
Loading
Loading