-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[WIP] Black applied #1967
[WIP] Black applied #1967
Conversation
For some reason CodeFactor started to work. Previously all of the errors were ignored. So it found 25 more issues |
is this not going to introduce many merge conflicts? (for pending PR's I mean) |
It should, I am referring to #1610 (review) . If I understood the comment correctly |
It looks like codefactor is only running on changes, and since you change every file, it will now give the warnings |
let's ignore all |
That's one of the points of black formatter. It is applying standard on the entire file, and you can't specify config. Which means the code will be always the same from project-to-project, commit-to-commit and user-to-user. So far in the repo there is So if it would be ignored - there is no point to add black at all. So there would be no point of using |
it is not true, this can be configures as well as you could ignore it when you run black on the whole repo
Black also say
I believe that block is not only about |
|
Codecov Report
@@ Coverage Diff @@
## master #1967 +/- ##
======================================
Coverage 86% 86%
======================================
Files 75 75
Lines 4705 4705
======================================
Hits 4064 4064
Misses 641 641 |
let's me express myself (this is not all core/lightning opinion) I think that we still shall let contributors keep their freedom (it is not always easy and pleasant to change some coding habits) in things which are not mandatory, at this moment the content and fast iteration is more important than cool formatting... we do not want anyone to discourage by forcing to code the way he/she does not like/want... We have some strict/mandatory formatting rules introduced by PEP8 (checked by flake8) the black style is just nice to have and we did (you adding e.g. the pre-commit) maximum for contributors to use it... and thank you for your initiative in this direction 🦝 |
so maybe check it there is something like |
@Borda I also typically use |
if we have to set a default, then ' over " |
This pull request is now in conflict... :( |
As I understand, it will just ignore the difference between |
@kumuji can you rebase? |
Let's ignore it and remove this diffs from this PR |
This pull request is now in conflict... :( |
This pull request is now in conflict... :( |
This pull request is now in conflict... :( |
@kumuji PEP bot complains about a missing whitespace after I applied black to a file here in this |
Sometimes it is happening, but I couldn't track why. But in many repos |
@kumuji ok, seems to be a bug then. However, I would vote against adding E231 as exception, it's what you meant I guess. |
One thing we should make sure to do is to have this commits marked with |
@kumuji @f4hy I am curious, is there a pre-commit hook or something similar, such that everytime we merge a PR into master, right before that it will automatically run black. Then we wouldn't need to review formatting changes on every PR and just let black do it once we merge? That's a feature I could see useful but no idea if this creates problems. |
I don't think Github actions are allowed to modify code. Looks like this project attempted to do what you wanted but it does not work. We can offer a shell script that would install a pre-commit hook for developers so that their code is formated on commit. so when they make the PR it will automatically be formated. It would require people to install that hook locally though. After the update, I made in |
Yes I thought about that, and I would also personally use black if not for the annoying problem that when it formats the whole file even if you just made a few changes in some section. This makes it harder to review the PR when so much whitespace was changed. |
Ya, I think thats why a single on time format and enfrocing the format for all future PRs is good. It removes that issue for everything after that point. |
that may be tricky as not all people would use and those who will may have much large diff cased formatting changes...
There is no benefit of it as it takes a couple minutes and even if it fails there is blocker for a user to commit his change... |
we have found some Black rules quite silly, is there a way how to ignore some? |
I think we already have python -m pip install pre-commit
pre-commit install It will add pre-commit hook which will run black on the code. And later we have github action to verify if code is
We already have |
I found some of their statements false like "it minimizes diffs" as with just adding or removing a single argument it changes the function single line to multiline and back... |
Before submitting
What does this PR do?
#1610
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃