-
Notifications
You must be signed in to change notification settings - Fork 9
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
Enable black formatter #49
base: master
Are you sure you want to change the base?
Conversation
We want to use Black that is a PEP 8 compliant opinionated formatter. This commit has been generated by running `black --unstable` on python files. In the next commit we will add a workflow that will run this automatically. Signed-off-by: Guillaume <[email protected]>
b34acd7
to
0435244
Compare
We don't format the code. It is up to the developer to call black on its own code. The workflow only checks that formatting is ok. Signed-off-by: Guillaume <[email protected]>
5531ac5
to
8d532c0
Compare
What problem is this PR solving in the first place? The commit message says "We want to use Black that is a PEP 8 compliant opinionated formatter", but it's not enough of a reason, as While not entirely against, I have several concerns:
|
The main reason is to have a better homogeneous code that is more readable IMHO. But I understand your remarks so we can ignore the PR no worries. Another annoying thing is that it breaks a little bit the search using "git blame" to understand some changes. I'm using it for bigger project and refactoring is always annoying for git search... And about the setup of IDE, it is true that it's up to the developer to setup its environment but you can setup your IDE or setup some git hook in your local repo or run it manually and there are probably other ways to do it. It is not a big constraint IMHO. |
I'm afraid it is for occasional contributors. It raises the bar for people who sometimes already struggle with git and github. We can always help them, but experience shows the more things we ask, the more some are prone to giving up. |
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'm all for it.
My experience with formatters is that they sometimes get in the way when something complicated has to be formatted specially to make it easier to understand. I have a general dislike for that kind of tools. |
It's why there is a specific feature in many formatters to handle these cases: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#ignoring-sections |
I will try to be pragmatic:
|
I would have to use it much too often, and that defeats the whole purpose of the tool. But this is a discussion we should have a project level, not on any particular project like this. |
How can you be totally sure about that?
I completely agree. But complicated to set up currently on the installer, and even less on SMAPIv1. But for v3 it is clearly up for discussion in my opinion. |
Sometimes when the code is to complicated to be formatted means that code needs to be rewritten. I don't say it is always the case and I'm sure that we will find cases where disabling formatting is justified. But when there are issues with formatting it is often a good time to think differently ;-) |
By simply running it on a single file I wrote recently |
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.
Must be discussed at project level first
Black is a PEP 8 compliant opinionated formatter with its own style.