PEP 8 Inspection over-generalizes blank lines around functions
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.2k
- Forks
- 754
- PR merge metrics
- No merged PRs in 30d
Description
PEP 8 only requires blank lines around "top-level function and class definitions" and "method definitions inside a class". However, pep8 marks any function without a line above it as failing the rule.
This is especially troublesome for functions that are inside other functions or methods, because they are often short and have no reason for a line above:
def test():
def success_callback(): # no need for blank line above
print('Success! A wonderful thing has completed!')
def error_callback(): # no need for blank line above
print('Error! The entire program is crashing around us!')
run_async_function(success_callback, error_callback)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The repository is described as one Python file; start by locating the PEP 8 blank-line inspection for function definitions. Verify the behavior against the nested-function example, then confirm that the check still applies to top-level functions, classes, and methods. No test file is named in the issue.
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
- 48/100