-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
⚫ 🔨 Automatically lint with black #605
Conversation
Trigger CI
Trigger CI
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 guess we can resolve most conflicts with other PRs by running the formatting tools in the respective branches first, right?
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.
So many '
to "
changes 😅
Edit: Did you check manually? 😄
@mberr yes I hope this doesn't cause too many conflicts! It might require copying the config from the @lvermue yup, apparently double quotes are the future. I was against this in the beginning but I gave up my opinion. Many people also didn't like this so much that they harassed the developer of black... not cool at all. Black has a guarantee that the code produces the same AST, so I'm actually very confident without manually checking that it is still the same. black is both deterministic and idempotent (i.e., a fancy word meaning if you run it multiple times in a row it is always guaranteed to be the same as after just running it once). Further, we have a really excellent testing suite here that seems to be happy :) |
One question before merging though - do we really want 120 line width or should we go 100 like most of my other projects? Alternatively, we can not specify at all and go with the defaults, which will make them get around 89 (but goes over in reasonable cases) |
I am in favour of wide lines 🙂 if it was only for me, we would stick with one line = one statement, and let your favourite editor do the line breaks with soft wrap, but I am aware that this is a rather unpopular opinion 🤷 |
I suppose it aligns it with the JSON standard and it makes it easier to use contracted words in most languages :) |
IIRC, we are using 120 right now and I'm fine with that |
This PR adds automatic linting with:
black
isort
These changes are guaranteed not to change the abstract syntax tree that python gets, so there are no reasons the code should change how it works at all - it's purely cosmetic. Neither of them look perfect, but they're both automated so we never have to think about how this stuff looks again, which is better in many ways.
Right now the settings are pinned to 120 character line length, but it might actually be better to just use the default (which is a bit shorter)