PyCQA / PyCQA/flake8-bugbear

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

Open
#266 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted terrible_maintainer
Dominant language
Python
Stars
1.1k
Forks
123
Avg merge
2d 5h
Merged PRs (30d)
5

Description

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...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin by reproducing the commands in the issue with flake8-bugbear and the minimal bug.py example. Trace how --extend-ignore, --ignore, and --extend-select are interpreted for E501 and B950, then add coverage for the differing command combinations and confirm the intended B950 reporting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.