question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What is the difference between B950 and max-line-length=88?

See original GitHub issue

I see that black recommends the following flake8 configuration:

[flake8]
max-line-length = 80
...
select = C,E,F,W,B,B950
ignore = E501

However, the same thing can be achieved with the following configuration, which is shorter and possibly more explicit:

[flake8]
max-line-length = 88
...
select = C,E,F,W,B

Can you please help me understand why we need B950, then?

Thank you for flake8-bugbear!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
ambvcommented, Oct 10, 2018

Oh. Now I see what you are actually asking for. Sorry.

The rationale behind B950 is also explained in the README. It’s meant to be a soft warning, highway-speed style. If you go over less than 10% then it’s just a distraction to slow you down and get you to bow to the Line Length Demigod.

In other words, if your project’s style says: “we want line length to be 80”, then set “–line-length=80”. If you use E501 and then flake8 will stop and yell at you if you make a line 81 characters long. If you use B950, it will only stop you if you go over 88 characters.

It might be a weird thing but the intent is for it to be more humane. If you are driving 5 km/h over the speed limit of 90 km/h, police will not stop you, it’s not worth it for either of you. But you don’t change the speed limit to 95 km/h. People would start going over that, too. If you are at a conference and you do a talk and go over 2 minutes in your 30 minute-long keynote, people will not drag you from the stage. It’s not worth it for either of you. But you don’t change the length of the keynote to be 32 minutes long. People would start going over that, too. And so on, and so on.

I hope this clears it up.

3reactions
pquentincommented, Oct 10, 2018

(Note that the url does not answer my question, since I was not asking how to enable B950, I was asking why it exists since it’s possible to get the same behavior without B950.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Black code style - Black 22.12.0 documentation
The coding style used by Black can be viewed as a strict subset of PEP 8. ... [flake8] max-line-length = 88 ... select...
Read more >
Configuration — flake8 2.5.5 documentation
Configuration¶. Configuration settings are applied in three ways: user, project, and the --config CLI argument. The user (global) configuration is read ...
Read more >
pip install black==18.3a4 - PyPI
If you're using Flake8, you can bump max-line-length to 88 and forget about it. Alternatively, use Bugbear's B950 warning instead of E501 ...
Read more >
neoclide/coc.nvim - Gitter
[coc.nvim] The "languageserver.python" server crashed 5 times in the last 3 ... "max-line-length = 88", "select = C,E,F,W,B,B950" ], "html.enable": true, ...
Read more >
git pre-commit Hooks for Python | KHE
[flake8] max-complexity = 10 max-line-length = 88 select = C,E,F,W,B,B950 ignore = # Use bugbear line length detection instead of default ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found