-
Notifications
You must be signed in to change notification settings - Fork 213
Use ruff as linter and code formatter #502
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
Conversation
Addresses #499 (comment) |
target-version = "py38" | ||
|
||
[lint] | ||
select = ["E", "F", "W", "C", "I"] |
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"
is for isort functionality
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.
Why not use the existing pyproject.toml
rather than introduce a new config file in ruff.toml
?
Edit: cc @ccordoba12
@ccordoba12 this PR is my Christmas present for you 😄. No more checking import order! Ruff takes care of that for you now 🎄 🎁 . Happy holidays! :) |
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.
Removed this since we're not using pycodestyle
anymore. ruff
takes care of that for us 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.
Can't we also remove .pylintrc
as well?
cc: @ccordoba12
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.
Yep, that's a good idea. I'll do that in a follow up PR.
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 submitted a PR for consideration for this just now.
@krassowski @ccordoba12 don't want to look impatient, but I'd love to get this in for all the contributors, making any lint/code style checks blazingly fast! :) |
Thanks! This was a nice present indeed and sorry for answering until now but I was taking advantage of the holidays to finish several PRs in Spyder.
Totally agree, so I'm going to merge your work 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.
Thanks @tkrabel!
this maybe conflicted with ruff plugin? since seems that didnot use latest ruff for now.
why not just use that ruff plugin if like to use ruff linter and formatter?
…--
shane.xb.qian
|
This PR was to use |
ok. but since when ruff supported py project.toml instead of ruff.toml?
// I did not check the change detail, just roughly read this in the mail.
…--
shane.xb.qian
|
I think from the very beginning. See here. Edit: Specifially
|
Ruff is incredibly fast (running it on the pylsp code base is INSTANT; static code analysis in our pipeline now only takes 21s!) and a drop-in replacement for pylint, pycodestyle, isort, and black.
This PR suggests the following:
pylint
andpycodestyle
. This simplifies the devloop (no need to run two commands anymore) and makes it much faster (ruff is REALLY fast and offers an autofix option, which I used already to address 10+ issues).black
. Since we use ruff as a linter, using it as a formatter keeps the devloop simple. The diff to black is minimal: only 5 function definitions we're indented differently. The rest was the same.