-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
define Yapf config #5591
define Yapf config #5591
Conversation
Codecov Report
@@ Coverage Diff @@
## release/1.2-dev #5591 +/- ##
================================================
- Coverage 89% 89% -0%
================================================
Files 168 168
Lines 12423 12267 -156
================================================
- Hits 11103 10933 -170
- Misses 1320 1334 +14 |
So why yapf over alternatives? (black, for example: https://news.ycombinator.com/item?id=17155048) |
We have already spoke about it, black is just one (no way to configure as far as I know) so you either like it or hate it... Btw, not sure how much it still relevant comment from 2018 (2 years ago) @carmocca have you check how Bolts looks like now? EDIT: in fact there are not so many alternatives, see Lightning-Universe/lightning-bolts#482 |
Never used yapf but reading online, seems like its the other way around. What I care about the most is that the formatter only allows one consistent single style. If yapf does, then that's OK with me |
So far I have tested, with one setting it does, but if you want we can test it a bit longer with Bolts first... |
the drawback is that if you change your mind about the config, you have to reformat the whole code base. foo_long_function_(arg1, arg2, arg3
arg4, arg5, arg6) it leads to uneven indentation which is just horrible in my opinion. |
Heh, that you are lucky guy, I hate it too =D |
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.
Love it ! Great addition !
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.
Great addition !
In Bolts, I had a collision between flake8 and yapf. Applying yapf caused the error |
we can configure this in yapf, right? |
@Borda Could you have a look at Lightning-Universe/lightning-bolts#539? I'm having difficulty in resolving the conflicts between pep8 (flake8) and yapf. It seems that yapf is not really compliant with pep8 even if we set:
|
In Bolts, we had conflicts between yapf and flake8, and @Borda resolved errors from flake8 by writing those lines in a different way. Lightning-Universe/lightning-bolts#539 So, here, I don't think we need to modify our flake8 config for now. |
I still think that you shall write reasonable code, and there are always multiple ways... :] |
What does this PR do?
eventually, we would move to Yet-Another-Python-Formater so this is just setting rules, for illustration how it goes you can check Bolts codebase when we have already deployed it
With deploy YAPF check we may drop ISORT which has atm incompatibility with PEP8, see PyCQA/isort#1594 (comment)
discussed with @tchaton and finetuned config with @akihironitta
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃