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

Replacement of flake8 with Ruff #1980

Merged
merged 7 commits into from
Oct 18, 2024
Merged

Replacement of flake8 with Ruff #1980

merged 7 commits into from
Oct 18, 2024

Conversation

SAMAD101
Copy link
Collaborator

@SAMAD101 SAMAD101 commented Apr 4, 2024

Description

This PR removes flake8 from .pre-commit-config.yaml , setup.cfg and adds ruff for linting

Related Issue

Resolves #1969

Motivation and Context

ruff is faster so yeah...

How Has This Been Tested?

Manually tested, pre-commit, make lint works fine.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

@shivansh02
Copy link
Collaborator

Screenshot from 2024-04-05 01-21-00

I tried checking E201 and E241 of flake8 but ruff couldn't catch them and were fixed by black.

@Hofer-Julian
Copy link
Collaborator

I tried checking E201 and E241 of flake8 but ruff couldn't catch them and were fixed by black.

Both rules are marked as preview, so I assume they will only be enabled in the next ruff release: https://docs.astral.sh/ruff/rules/#error-e

@shivansh02
Copy link
Collaborator

I tried checking E201 and E241 of flake8 but ruff couldn't catch them and were fixed by black.

Both rules are marked as preview, so I assume they will only be enabled in the next ruff release: https://docs.astral.sh/ruff/rules/#error-e

That makes sense. But I tried some stable ones (E501 and E703), failed to catch them also. @SAMAD101 can you check if this is working for you?

@shivansh02
Copy link
Collaborator

Also since more than half of the pycodestyle rules are still in preview, should we enable ruff's preview mode or wait for them to get stable before trying to replace flake8?

@SAMAD101
Copy link
Collaborator Author

SAMAD101 commented Apr 5, 2024

I tried checking E201 and E241 of flake8 but ruff couldn't catch them and were fixed by black.

Might be because it had to configured in ruff.toml Works fine now. Checked

@SAMAD101
Copy link
Collaborator Author

SAMAD101 commented Apr 5, 2024

I tried checking E201 and E241 of flake8 but ruff couldn't catch them and were fixed by black.

Both rules are marked as preview, so I assume they will only be enabled in the next ruff release: https://docs.astral.sh/ruff/rules/#error-e

That makes sense. But I tried some stable ones (E501 and E703), failed to catch them also. @SAMAD101 can you check if this is working for you?

Those seem to be working fine as well.
You can check them using: ruff check src/ --preview --select <rule_code>

Copy link
Collaborator

@real-yfprojects real-yfprojects left a comment

Choose a reason for hiding this comment

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

You should reset your fork's master brach to upstream since it is diverged for a long time already.

bin/.gitkeep Outdated Show resolved Hide resolved
ruff.toml Outdated Show resolved Hide resolved
@SAMAD101
Copy link
Collaborator Author

SAMAD101 commented Apr 6, 2024

You should reset your fork's master brach to upstream since it is diverged for a long time already.

will do

setup.cfg Outdated Show resolved Hide resolved
@m3nu
Copy link
Contributor

m3nu commented Apr 7, 2024

Just to be clear slow linting isn't a problem we have. So this change should also simplify the config in some way or make it easier to run.

@SAMAD101
Copy link
Collaborator Author

SAMAD101 commented Apr 7, 2024

Just to be clear slow linting isn't a problem we have. So this change should also simplify the config in some way or make it easier to run.

yeah, it does somewhat simplify the cofigs. And linting is just as easy to run as it was, we can use pre-commit or 'ruff check'

@m3nu m3nu merged commit 0fb76b6 into borgbase:master Oct 18, 2024
7 of 11 checks passed
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.

Replace flake8 with Ruff for faster linting
5 participants