Skip to content

Add ruff as the linter and formatter #527

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

Iteron-dev
Copy link
Member

@Iteron-dev Iteron-dev commented Jun 5, 2025

Resolves: #199 and is a replacement for the abandoned PR: #213.

Ruff is configured to use the following rules:

  • pycodestyle errors
  • pycodestyle warnings
  • pyflakes
  • isort
  • flake8-bugbear
  • pyupgrade
  • flake8-comprehensions

I also removed the old linting/formatting tools along with their scripts.

@Iteron-dev Iteron-dev marked this pull request as ready for review June 5, 2025 10:24
@Iteron-dev Iteron-dev requested a review from MasloMaslane as a code owner June 5, 2025 10:24
@Iteron-dev Iteron-dev self-assigned this Jun 5, 2025
@Iteron-dev Iteron-dev requested a review from twalen June 8, 2025 19:14
@Iteron-dev
Copy link
Member Author

I added pyupgrade and flake8-comprehensions. From what I’ve checked so far, adding them didn’t cause any tests to fail, and they significantly refactored the code, which will make it easier to transition to a newer Python version.

pre-commit install

From now on, ruff will run automatically before each commit - just keep in mind
that ruff will only run on the files you have modified.
Copy link
Contributor

Choose a reason for hiding this comment

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

You could add suggestion that it is possible run on all files using: pre-commit run --all-files

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@twalen
Copy link
Contributor

twalen commented Jun 9, 2025

For long lines you could add # noqa: E501 (right now Ruff step is failing)

@Iteron-dev
Copy link
Member Author

For long lines you could add # noqa: E501 (right now Ruff step is failing)

I'm aware of that – ruff format will break long lines, and for the problematic ones, I'll add # noqa: E501.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lint codebase with ruff
2 participants