-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
feat: Replaced flake8
with ruff
and removed setup.cfg
by merging the configurations into pyproject.toml
#27779
Conversation
Requesting review from @vedpatwardhan and @KareemMAX. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor point, rest of the changes look good. Let's see what @KareemMAX thinks. Thanks @Sai-Suraj-27 😄
@@ -1,25 +0,0 @@ | |||
[flake8] | |||
max-line-length = 88 | |||
ignore = E203, E402, E731, E704, W503, W504, W291, W293 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't fully know how this works, but shouldn't we be ignoring all of these in the pyproject.toml
? In the pyproject.toml
it seems to only be E203
, E402
and E731
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @vedpatwardhan
Yes, I didn't ignored those rules because of the following reasons,
- W291 : trailing whitespace warning
- W293 : blank line contains whitespace warning
These 2 should not be ignored + these 2 are taken care by the trailing-whitespace
check which I introduced a few months back (#22974)
https://github.com/unifyai/ivy/blob/3c6d6afee9812fdca8ee73b5bb10b3c3660e4e49/.pre-commit-config.yaml#L6
- W503 : line break before binary operator
- W504 : line break after binary operator
Ruff
didn't introduced these 2 checks in their checks because these 2 are really un-necessary rules that suggests us to have a line break before or after a binary operator.
- E704 : Multiple statements on one-line (def) (https://www.flake8rules.com/rules/E704.html)
This check is still not implemented byruff
for some reason + I think this is a good check. So, we don't need to ignore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I'll continue monitoring lint behavior to be sure
…ection (#9735) ## Summary I have recently made a contribution to a big python based repo **replacing flake8 with ruff** (ivy-llc/ivy#27779). So, as per this [discussion](#9731). I am making this PR to add the [ivy](https://github.com/unifyai/ivy) repository (**with > 13k stars ⭐**) to the Ruff's readme ## Test Plan No, need of any tests for the changes made.
PR Description
Replaced
flake8
with the following 2 major checks fromruff
Removed
setup.cfg
by merging the required configurations intopyproject.toml
Note
E721
check : Do not compare types, useisinstance()
rule wherever required.ruff
in pre-commit hooks because sometimes, the fixes might modify files/lines that needs to be formatted byblack
again. So, placed ruff hook before the black hook.noqa
comments for 3 rules (E501
: line-to-long,E722
: Do not use bare except, andE741
: ambiguous-variable-name) and removed the old ones asruff
requiresnoqa
comments to be added in a particular way.Related Issue
Closes #27775
Checklist
Socials