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

style: preparing actinia for Pylint 3.x with ruff #539

Open
neteler opened this issue Jul 1, 2024 · 0 comments
Open

style: preparing actinia for Pylint 3.x with ruff #539

neteler opened this issue Jul 1, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@neteler
Copy link
Member

neteler commented Jul 1, 2024

Preparing the repo for Pylint 3.x

Motivation

In the GRASS GIS project the Pylint configuration is created from scratch. In preparation for that, the entire Python code is updated with ruff (https://docs.astral.sh/ruff/, an extremely fast Python linter) to comply with Pylint 3 rules.

Steps

Here the respective steps to which might be applied to the actinia-* repos as well.

(Source: various recent Python code cleanup PRs in the GRASS GIS project, see https://github.com/OSGeo/grass/pulls?q=is%3Apr+is%3Aclosed+style)

# style: Fix single-line-implicit-string-concatenation violations (ISC001)
ruff check --select "ISC001" --fix

# style: Fixes unnecessary-collection-call (C408) for empty collections
ruff check --select "C408" --unsafe-fixes --fix --config "lint.flake8-comprehensions.allow-dict-calls-with-keyword-arguments = true"

# style: Fixes unnecessary-collection-call (C408) for testsuite
ruff check --select "C408" --unsafe-fixes --output-format=concise --fix

# style: Fixes manual-from-import (PLR0402)
ruff check --output-format=concise --select PLR0402 --fix

# style: Fixes if-stmt-min-max (PLR1730)
ruff check --output-format=concise --select PLR1730 --preview --fix

# style: Fixes sys-exit-alias (PLR1722)
ruff check --select "PLR1722" --unsafe-fixes --output-format=concise --fix

# style: Fixes literal-membership (PLR6201)
ruff check --output-format=concise --select PLR6201 --preview --unsafe-fixes --fix

# style: Fixes useless-return (PLR1711)
ruff check --output-format=concise --select PLR1711 --fix

# style: Fixes useless-exception-statement (PLW0133)
ruff check --output-format=concise --select PLW0133 --unsafe-fixes --fix

# style: Sort and group imports
ruff check --output-format=concise --select I --fix
isort --profile=black .
black .

# style: Fixes some unnecessary-lambda (PLW0108)
ruff check --output-format=concise --select PLW0108 --preview --fix --unsafe-fixes

Some fine tuning might be needed but most will be straight-forward.

@neteler neteler added the enhancement New feature or request label Jul 1, 2024
@mmacata mmacata changed the title style: preparing actinia for Pylint 3.x style: preparing actinia for Pylint 3.x with ruff Aug 8, 2024
@mmacata mmacata mentioned this issue Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant