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.

B950 does not give warnings when --extend-ignore'ing E501

See original GitHub issue

In an empty folder (no .flake8, tox.ini, or setup.cfg present)

echo "foo = 'foo'" > bug.py
flake8 --extend-ignore=E501 --extend-select=B950 --max-line-length=9 bug.py 

Gives me no errors.

Adding verbose logging (-vv) tells me:

flake8.main.application   MainProcess     62 INFO     Reporting errors
flake8.style_guide        MainProcess     62 DEBUG    Deciding if "E501" should be reported
flake8.style_guide        MainProcess     62 DEBUG    The user configured "E501" to be "Selected.Explicitly", "Ignored.Explicitly"
flake8.style_guide        MainProcess     62 DEBUG    "E501" will be "Decision.Ignored"
flake8.style_guide        MainProcess     63 DEBUG    Violation(code='E501', filename='bug.py', line_number=1, column_number=10, text='line too long (11 > 9 characters)', physical_line="foo = 'foo'\n") is not inline ignored
flake8.style_guide        MainProcess     63 DEBUG    Deciding if "B950" should be reported
flake8.style_guide        MainProcess     63 DEBUG    The user configured "B950" to be "Selected.Explicitly", "Ignored.Explicitly"
flake8.style_guide        MainProcess     63 DEBUG    "B950" will be "Decision.Ignored"
flake8.style_guide        MainProcess     63 DEBUG    Violation(code='B950', filename='bug.py', line_number=1, column_number=12, text='line too long (11 > 9 characters)', physical_line="foo = 'foo'\n") is not inline ignored
flake8.main.application   MainProcess     63 INFO     Found a total of 2 violations and reported 0

It appears that --extend-ignore=E501 makes flake8 think it can ignore B950 because E501 is part of the default ignore list. And I can’t find any flake8 or bugbear version combination where this has ever worked… The reported debugging info for B950 is the same as when not using any ignores at all.


Using --ignore=E501 instead of --extend-ignore makes it work as expected, but of course we don’t want to override the default ignore list.

flake8 --ignore=E501 --extend-select=B950 --max-line-length=9 bug.py 
flake8.main.application   MainProcess     64 INFO     Reporting errors
flake8.style_guide        MainProcess     64 DEBUG    Deciding if "E501" should be reported
flake8.style_guide        MainProcess     64 DEBUG    The user configured "E501" to be "Selected.Explicitly", "Ignored.Explicitly"
flake8.style_guide        MainProcess     64 DEBUG    "E501" will be "Decision.Ignored"
flake8.style_guide        MainProcess     64 DEBUG    Violation(code='E501', filename='bug.py', line_number=1, column_number=10, text='line too long (11 > 9 characters)', physical_line="foo = 'foo'\n") is not inline ignored
flake8.style_guide        MainProcess     64 DEBUG    Deciding if "B950" should be reported
flake8.style_guide        MainProcess     64 DEBUG    The user configured "B950" to be "Selected.Explicitly", "Selected.Implicitly"
flake8.style_guide        MainProcess     64 DEBUG    "B950" will be "Decision.Selected"
flake8.style_guide        MainProcess     64 DEBUG    Violation(code='B950', filename='bug.py', line_number=1, column_number=12, text='line too long (11 > 9 characters)', physical_line="foo = 'foo'\n") is not inline ignored
flake8.main.application   MainProcess     64 INFO     Found a total of 2 violations and reported 1
bug.py:1:12: B950 line too long (11 > 9 characters)

In total the following table shows all issues:

ignore select reports B950
–extend-ignore=E501 –extend-select=B950 NO
–extend-ignore=E501 –select=B950 NO
✔️ –ignore=E501 –select=B950 YES
✔️ –ignore=E501 –extend-select=B950 YES
–extend-select=B950 (only) E501
✔️ –select=B950 YES

Not sure about the second last line, whether it is expected to report both E501 and B950 or E501 alone…

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
sco1commented, Jun 25, 2022

This should now be resolved upstream via https://github.com/PyCQA/flake8/pull/1609 🎉

$ flake8 --extend-ignore=E501 --extend-select=B950 --max-line-length=9 bug.py
bug.py:1:12: B950 line too long (11 > 9 characters)
$ flake8 --extend-ignore=E501 --select=B950 --max-line-length=9 bug.py
bug.py:1:12: B950 line too long (11 > 9 characters)

IMO the README should still be reverted until Flake8 next is released.

0reactions
sco1commented, Aug 1, 2022

The README could probably be updated to flake8 >=5.0 for extend-select, perhaps with a second configuration example that works as expected pre-5.0 for folks who aren’t able to update for whatever reason. This should also take care of #221 (again).

Perhaps with #260 at the same time?

Read more comments on GitHub >

github_iconTop Results From Across the Web

`extend-ignore` and `extend-select` options seem to be ignored
I see the B950 line too long violation show up. I'm not sure if extend-select being ignored is an issue in flake8-bugbear or...
Read more >
Unprepared: Thinking of a trigger warning does not prompt ...
One potential explanation for the consistent finding in the literature that trigger warnings fail to ameliorate negative emotional reactions is that these ...
Read more >
An Introduction to Content Warnings and Trigger Warnings
Content warnings and trigger warnings are not intended to censure instructors nor invite students to avoid material that challenges them. On the contrary, ......
Read more >
flake8-bugbear issues - Git Memory
Contains warnings that don't belong in pyflakes and pycodestyle. ... B950 does not give warnings when --extend-ignore'ing E501. 6 comment.
Read more >
Trigger and Content Warning Guidance - provost@uconn.edu
This language is in no way intended to impede academic freedom, but to offer another opportunity for you to support your student's ability...
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