Skip to content

Add Ruff rules for PEP naming#2458

Merged
VeckoTheGecko merged 9 commits intoParcels-code:v4-devfrom
VeckoTheGecko:ruff-pep8
Jan 9, 2026
Merged

Add Ruff rules for PEP naming#2458
VeckoTheGecko merged 9 commits intoParcels-code:v4-devfrom
VeckoTheGecko:ruff-pep8

Conversation

@VeckoTheGecko
Copy link
Contributor

Picked up some inconsistencies in our code along the way which was nice!

See commit history for changes, and see updated pyproject.toml for updated rules.

Fixes #2457

Notable changes:

  • renamed applyConversion to apply_conversion in Field and VectorField .eval() methods

@VeckoTheGecko
Copy link
Contributor Author

Also added a rule PGH004 in 799db8d .

This prevents the blanket use of noqa comments - this makes it specific which rule we want to ignore. So if there are multiple violations on a line, we only ignore the one we want.

For example,

- import parcels  # noqa
+ import parcels  # noqa: E402

Do you think that's ok @erikvansebille ? It would have the additional step of copying the code from the pre-commit output and pasting it next to noqa:
e.g,

E402 Module level import not at top of file
  --> docs/conf.py:96:1
   |
94 | #
95 | # The short X.Y version.
96 | import parcels
   | ^^^^^^^^^^^^^^
97 |
98 | version = parcels.__version__

Copy link
Member

@erikvansebille erikvansebille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@VeckoTheGecko VeckoTheGecko enabled auto-merge (squash) January 9, 2026 16:46
@VeckoTheGecko VeckoTheGecko merged commit 92fe65a into Parcels-code:v4-dev Jan 9, 2026
9 of 10 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Parcels development Jan 9, 2026
@VeckoTheGecko VeckoTheGecko deleted the ruff-pep8 branch January 20, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Enforcing PEP8 naming conventions in Parcels

2 participants