-
Notifications
You must be signed in to change notification settings - Fork 3
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
#88: Add Ruff! #106
#88: Add Ruff! #106
Conversation
pyproject.toml
Outdated
] | ||
include = [ | ||
"screenpy", | ||
"tests", |
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.
For some reason setting this has a negative impact on being able to run ruff against the whole project. We might consider leaving it out. Or just adding "docs" to the exclude.
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.
Can you be more specific? I'm able to run the pre-commit hook without any issues with these settings.
pyproject.toml
Outdated
"FBT", # flake8-boolean-trap | ||
"FIX", # flake8-fixme | ||
"FLY", # flynt | ||
"FURB", # refurb |
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 get the following warning with this ruleset.
warning: Selection `FURB` has no effect because the `--preview` flag was not included.
Are you getting that too?
My suggestion would be to avoid preview rulesets for now.
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.
--preview
is for the rules that are still being workshopped. This one used to be fine, but got moved there—i had used it on my other project and it was real nice.
It might be annoying, though, when this is removed and you have to fix the issues in the middle of a different PR. I'll comment it out like you had, in a "we want this someday but not yet" section.
pyproject.toml
Outdated
"B", # flake8-bugbear | ||
"BLE", # flake8-blind-except | ||
"C4", # flake8-comprehensions | ||
"D", # pydocstyle |
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.
We get a lot of errors on the test modules. Personally I don't think we need to run this rule against any of the tests.
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.
Ah... the pre-commit hooks only consider the screenpy/**
files to be --all-files
, this is what was tripping me up.
I'll remove tests
from the directories to ruff up.
pyproject.toml
Outdated
] | ||
ignore = [ | ||
"D107", # missing __init__ docstring, we do that in the class docstring. | ||
"D203", # one blank line before class; we want 2! |
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.
We want no blank lines before the class, don't we?
class Something:
"""blah blah"""
What you're describing would look like this:
class Something:
"""blah blah"""
And afaik, there isn't a rule to enforce that.
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.
Yeah, uh, i misunderstood the rule. Ruff said that it was conflicting with another rule that suggested 2 blank lines.
I'll update the comment to reflect the real world.
This would be my suggested rule adjustments. Some of the super opinionated rules could be left out. There are also a couple of rulesets that will conflict with 3.8 & 3.9.
|
@bandophahita ready for review! Thank you for your thoughts—i rearranged the includes/excludes, commented out I actually like and agree with the opinions in the rulesets you marked as opinionated, we can talk more about those if you'd like. I've used them in other projects and found the code much easier to read, maintain, and understand with their suggestions. |
Ruff is pretty neat. It's got a lot of different linters all in one spot, and it runs super freakin' quick.
This PR adds
ruff
with our own stew of selected-and-ignored rules and rulesets.