-
Notifications
You must be signed in to change notification settings - Fork 15
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
Use ruff for formatting #133
base: master
Are you sure you want to change the base?
Conversation
line-length = 120 | ||
|
||
[tool.ruff.format] | ||
quote-style = "single" |
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 saw that we currently use a lot of 'foo'
style strings instead of the ruff default "bar"
strings.
@@ -46,5 +47,12 @@ balanced_wrapping = false | |||
known_typing = "typing" | |||
sections = "FUTURE,STDLIB,TYPING,THIRDPARTY,FIRSTPARTY,LOCALFOLDER" | |||
|
|||
[tool.ruff] | |||
target-version = "py38" | |||
line-length = 120 |
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.
IMO 120 is quite long, but isort was configured like this.
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 me 120 feels quite long too, generally I prefer 80 (or max. 100).
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 think 100 is the sweet spot.
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 have no clear opinion about this. Generally I like consistent and enforced formatting and also the style looks quite good to me. But especially some configuration lists (e.g. FetConfig
or ChipConfig
) are getting more verbose / harder to read. Though not too bad I guess 🤔 Anyway, I would prefer a shorter line length.
Btw I never hear of ruff, so no opinions about that tool 😉
@@ -46,5 +47,12 @@ balanced_wrapping = false | |||
known_typing = "typing" | |||
sections = "FUTURE,STDLIB,TYPING,THIRDPARTY,FIRSTPARTY,LOCALFOLDER" | |||
|
|||
[tool.ruff] | |||
target-version = "py38" | |||
line-length = 120 |
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 me 120 feels quite long too, generally I prefer 80 (or max. 100).
'https://www.diodes.com/assets/Datasheets/DMC6040SSDQ.pdf', | ||
]), | ||
|
||
FetConfig( |
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.
In places like these I'd suppress the formatter... Is there a way to disable ruff for a block of code (using a stop / start command)?
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.
One can just add # fmt: off
/ on
pairs.
I'm a fan of autoformatters, as long as they allow sufficient control and can be disabled for certain parts of the code if necessary. So +1 from my side for ruff. |
This is just a quick PR to answer the following questions: