PyCQA / PyCQA/pycodestyle

E301: reported incorrectly after ignored E303

Open
#925 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.2k
Forks
754
PR merge metrics
No merged PRs in 30d

Description

Hello, 👋

I have a following code in foo.py:

     1	class FooBar:
     2	
     3	    def foo(self):
     4	        pass
     5	
     6	
     7	    # Comment
     8	
     9	    def bar(self):
    10	        pass


and running pycodestyle --ignore=E303 foo.py (E303 - Too many blank lines) reports foo.py:9:5: E301 expected 1 blank line, found 0 even there is a blank line.

There is one more thing that is confusing me - I'm able to fix this error by adding new line between def bar and pass.

Any idea what could be wrong here?
Thanks

Contributor guide

Open the contributing guide

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

Reproduce the report with the shown foo.py example and the pycodestyle --ignore=E303 foo.py command. Trace how ignored E303 findings affect the E301 blank-line calculation; done when the existing blank line no longer produces a false E301 while E303 remains ignored.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.