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

Shouldn't max-line-length be 80 when using bugbear? #3716

Closed
Alveel opened this issue Jun 4, 2023 · 3 comments · Fixed by #3731
Closed

Shouldn't max-line-length be 80 when using bugbear? #3716

Alveel opened this issue Jun 4, 2023 · 3 comments · Fixed by #3731
Labels
C: configuration CLI and configuration T: documentation Improvements to the docs (e.g. new topic, correction, etc)

Comments

@Alveel
Copy link
Contributor

Alveel commented Jun 4, 2023

Is this related to a problem? Please describe.

The documentation suggests using flake8-bugbear instead of just bumping max-line-length to 88, as bugbear already handles a line max 10% longer than max-line-length. However, the example with bugbear below it still uses 88.

What this effectively means is that flake8 (with bugbear) won't complain about lines up to 96 characters long.

I think the example value should be 80:

[flake8]
max-line-length = 80
...
select = C,E,F,W,B,B950
extend-ignore = E203, E501
@Alveel Alveel added the T: documentation Improvements to the docs (e.g. new topic, correction, etc) label Jun 4, 2023
@cooperlees
Copy link
Collaborator

I think here our intention was just to "be safe" for people not running bugbear as well who copy paste. Reading is hard. At the end of the day we just want flake8 to not bother warning black enabled repositories about the line length, as, after all, you're using an autoformatter and you shouldn't ever hit the line lint warning ...

Happy to discuss further, but I think for people not reading and parsing that flake8-bugbear does this we might get some people who copy paste and wonder what is going on. I would be down to add this context to the docs tho, leaving the default if you think that helps.

@cooperlees cooperlees added the C: configuration CLI and configuration label Jun 5, 2023
@Alveel
Copy link
Contributor Author

Alveel commented Jun 9, 2023

Perhaps the phrasing can be improved to be more explicit about this? It's currently very open and suggestive. Black is supposed to be opinionated and uncompromising, is it not? ;)

Suggested, more concise text:

If you use Flake8, you have a few options:

  1. Recommended is using Bugbear and enabling its B950 check instead of using Flake8's E501, because it aligns with Black's 10% rule. Install Bugbear and use the following config:

    [flake8]
    max-line-length = 80
    ...
    select = C,E,F,W,B,B950
    extend-ignore = E203, E501
  2. For a minimally compatible config:

    [flake8]
    max-line-length = 88
    extend-ignore = E203

@cooperlees
Copy link
Collaborator

Sure feel free to make a PR of making it more concise. Easier for people to comment there.

cooperlees pushed a commit that referenced this issue Jun 12, 2023
* Make phrasing for flake8 users more concise

max-line-length should be 80 with flake8-bugbear
Fixes #3716

* Re-add rationale and an explanation for

disabling E203

* Run pre-commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: configuration CLI and configuration T: documentation Improvements to the docs (e.g. new topic, correction, etc)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants