Skip to content
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

Provide lists of lint / pycodestyle rules that Black makes obsolete #429

Open
nixjdm opened this issue Jul 31, 2018 · 11 comments
Open

Provide lists of lint / pycodestyle rules that Black makes obsolete #429

nixjdm opened this issue Jul 31, 2018 · 11 comments
Labels
T: documentation Improvements to the docs (e.g. new topic, correction, etc)

Comments

@nixjdm
Copy link

nixjdm commented Jul 31, 2018

Information Request / Addition to README

This is related to #259 (comment), but I have the opposite aim as that thread. For me, my editor shows everything flake8 is catching for me, but many things I'm intentionally not worrying about because I know Black will handle it. I want to continue to have flake8 tell me valuable things, but never bother me for anything Black handles. They are distractions. I can add all of these rules to my .flake8, which works great, but I've been only finding them as I go.

Is there a complete list of Black-made obsolete pycodestyle rules? I know only a subset of these rules are made obsolete.

I'd love to just drop that list in my .flake8 and never be bothered by the obsolete rules again. I suggest adding this list to the README.

@jgirardet
Copy link
Contributor

jgirardet commented Jul 31, 2018

The black plugin fur sublimetext has this addon, if it may help
https://github.com/kaste/SublimeLinter-addon-black-for-flake
In the source :
uper_fn = None
BLACK_FIXABLES = (
'E111,E121,E122,E123,E124,E125,E126,'
'E201,E202,E203,'
'E221,E222,E225,E226,E227,E231,E241,E251,E261,E262,E265,E271,E272,'
'E302,E303,E306,'
'E502,'
'E701,E702,E703,E704,'
'W291,W292,W293,W391'.split(',')
)

@zsol zsol added the T: documentation Improvements to the docs (e.g. new topic, correction, etc) label Aug 1, 2018
@zsol
Copy link
Collaborator

zsol commented Aug 1, 2018

Sounds like a reasonable thing we could document in the README :) Care to put together a PR?

@nixjdm
Copy link
Author

nixjdm commented Aug 1, 2018

@zsol Not at all, if you don't mind waiting for me to find the time! I'm a little busy at the moment, but I may free up in a week or two.

Additionally, adding all of these to explicit tests would help ensure the rules stay obsolete, and help justify individual rules being on the list. Though the tests may also be redundant if they're already covered. I suspect most of them are. Would you like that too?

@nixjdm
Copy link
Author

nixjdm commented Aug 1, 2018

@jgirardet Thanks for that list! Do we have any idea if it's 'complete'?

@jgirardet
Copy link
Contributor

We should ask to @kaste

@kaste
Copy link

kaste commented Aug 1, 2018

It's not complete bc I ignored all tab warnings.

@tony
Copy link
Contributor

tony commented Aug 25, 2018

We may also have to add W503 to this list: #52

tony added a commit to tmux-python/tmuxp that referenced this issue Aug 25, 2018
tony added a commit to tmux-python/libtmux that referenced this issue Aug 25, 2018
tony added a commit to vcs-python/libvcs that referenced this issue Aug 25, 2018
tony added a commit to tmux-python/libtmux that referenced this issue Aug 25, 2018
tony added a commit to vcs-python/vcspull that referenced this issue Aug 25, 2018
tony added a commit to cihai/cihai that referenced this issue Aug 25, 2018
tony added a commit to cihai/unihan-etl that referenced this issue Aug 25, 2018
tony added a commit to cihai/unihan-db that referenced this issue Aug 25, 2018
tony added a commit to cihai/cihai-cli that referenced this issue Aug 25, 2018
@chdsbd
Copy link

chdsbd commented Mar 14, 2019

Thanks for creating this issue. This is the list I've come up with:

E101
E111
E114
E115
E116
E117
E121
E122
E123
E124
E125
E126
E127
E128
E129
E131
E133
E2
E3
E5
E701
E702
E703
E704
W1
W2
W3
W503
W504

I wouldn't mind creating tests for this, but I'm not sure if they belong in or would be accepted in the Black repo. Maybe we should create a separate project?

@nixjdm
Copy link
Author

nixjdm commented Mar 14, 2019

@chdsbd, thank you for your additional list. It differs from https://github.com/kaste/SublimeLinter-addon-black-for-flake/blob/master/plugin.py. I haven't checked every rule in both lists, the I'd argue the true list is probably a combination of the two, maybe plus more (e.g. E223/E224, I assume). It's a sufficiently long list, and hard enough to keep in my head, that tests make a lot of sense to me.

IMO this list should be rules Black makes obsolete because it makes a decisive choice, not necessarily because it fixes it. If Black actively chooses to break a rule, it is still something I want to ignore. Let me pick on a rule in your list, but not Sublime's, to illustrate.

  • W503 line break before binary operator: Black tries to prevent this, but will sometimes actively break this rule if there's enough complexity. Either way, it's controlled by Black, not the user, so it should be ignored. Sublime's omission is right that Black doesn't always fix it, but it does control it, which I think is the better criterion.

Lothiraldan added a commit to Lothiraldan/bugbug that referenced this issue Apr 9, 2019
Disable Flake8 rules that are handled by Black. The list comes from
psf/black#429 (comment).
marco-c pushed a commit to mozilla/bugbug that referenced this issue Apr 9, 2019
* Add pre-commit configuration

Add auto-formatting configuration using the https://pre-commit.com/ project.
Having auto-formatting setup and automatically enforced helps speeding up
development and review process.

* Apply the auto-formatting on all files in the repository

* Removes flake8-quotes as it conflicts with Black formatting

* Disable some Flake8 rules

Disable Flake8 rules that are handled by Black. The list comes from
psf/black#429 (comment).
EnTeQuAk added a commit to mozilla/addons-server that referenced this issue Nov 6, 2019
HyukjinKwon added a commit to databricks/koalas that referenced this issue Feb 22, 2020
This PR proposes to add [Black](https://github.com/psf/black) into Koalas.

- `dev/linter-python` detects if codes are formatted or not by Black
- `dev/reformat` script that reformats the codes by using black.
- It still keeps 100 line length style, and ignores `E231` and `E203` at pycodestyle. See also psf/black#429 and psf/black#1202. Black automatically formats and violates several rules.
- Update contribution guide.

Resolve #755

Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
@ichard26
Copy link
Collaborator

ichard26 commented Jun 4, 2020

Ping! I think PR #1371 pretty much resolves this issue. Although, I should look into why the list above has a lot of ignore rules.

@kaste
Copy link

kaste commented Jun 4, 2020

As for SublimeLinter, this list here is applied as a post filter. T.i. you can have a normal flake8 configuration for example for CI, only in the editor then a lot of errors are suppressed iff you're running the black formatter e.g. on save. That's why you have a minimal list for where black and flake8 just disagree, and the maximal list provided here where black is a fixer for flake8 errors.

rising-star92 added a commit to rising-star92/databricks-koalas that referenced this issue Jan 27, 2023
This PR proposes to add [Black](https://github.com/psf/black) into Koalas.

- `dev/linter-python` detects if codes are formatted or not by Black
- `dev/reformat` script that reformats the codes by using black.
- It still keeps 100 line length style, and ignores `E231` and `E203` at pycodestyle. See also psf/black#429 and psf/black#1202. Black automatically formats and violates several rules.
- Update contribution guide.

Resolve #755

Co-authored-by: Deepyaman Datta <deepyaman.datta@utexas.edu>
tony added a commit to cihai/unihan-etl that referenced this issue Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: documentation Improvements to the docs (e.g. new topic, correction, etc)
Projects
None yet
Development

No branches or pull requests

7 participants