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

E266 & E271 #19

Merged
merged 12 commits into from
Oct 21, 2024
Merged

E266 & E271 #19

merged 12 commits into from
Oct 21, 2024

Conversation

… N805 and N813 (#4556)

* style: Enable checking for pep8-naming (N) rules with Ruff

Rules already respected:
- dunder-function-name (N807)
- constant-imported-as-non-constant (N811)
- camelcase-imported-as-acronym (N817)

* style: Fix invalid-first-argument-name-for-class-method (N804)

Ruff rule: https://docs.astral.sh/ruff/rules/invalid-first-argument-name-for-class-method/

Two files had class methods that didn't use cls as their first argument

* style: Fix camelcase-imported-as-lowercase (N813)

Ruff rule: https://docs.astral.sh/ruff/rules/camelcase-imported-as-lowercase/

One instance only in a pytest file

* style: Fix invalid-first-argument-name-for-method (N805)

Ruff rule: https://docs.astral.sh/ruff/rules/invalid-first-argument-name-for-method/

Three instances in gui/wxpython/mapswipe/frame.py were ignored, as an inner class is defined using self2 and also references self from the containing class.
…le issues (#4560)

* style: Fix missing-whitespace (E231)

* style: Fix mixed-spaces-and-tabs (E101)

Ruff rule: https://docs.astral.sh/ruff/rules/mixed-spaces-and-tabs/

* style: Enable checking for E ruff rules from pycodestyle

* style: Fix multiple-leading-hashes-for-block-comment (E266)

Ruff rule: https://docs.astral.sh/ruff/rules/multiple-leading-hashes-for-block-comment/

For gui/wxpython/psmap/frame.py, the commented code was present since it was moved from addons to the main repo 13 years ago. At the time, both pair of lines had the same indentation, before PEP8 only formatted the second lines.

File temporal/t.rast.what/t.rast.what.py is ignored for E265 and E266, as it is being addressed in #4550
Ruff rule: https://docs.astral.sh/ruff/rules/if-else-block-instead-of-if-exp

Since the amount of changes for SIM108 are quite large, (more than 330), I've decided to split the fixes in more than 1 PR. I kept `scripts/*`, `python/*` and `gui/*` in other PRs.

To avoid conflicts, I didn't commit the modified `pyproject.toml`, nor extra typing annotations that I used to help guiding and validating these fixes.

* style: Fix if-else-block-instead-of-if-exp (SIM108) in utils/

* style: Fix if-else-block-instead-of-if-exp (SIM108) in lib/init/grass.py

* style: Fix if-else-block-instead-of-if-exp (SIM108) in doc/

* style: Fix if-else-block-instead-of-if-exp (SIM108) in man/build_html.py

* style: Fix if-else-block-instead-of-if-exp (SIM108) in temporal/

* style: Manual fixes of if-else-block-instead-of-if-exp (SIM108) in temporal/
@github-actions github-actions bot added the C label Oct 21, 2024
@a0x8o a0x8o merged commit 15134e1 into a0x8o:main Oct 21, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants