PyCQA / PyCQA/eradicate

Commented out code not detected when code block is two lines long

Open
#36 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
218
Forks
26
PR merge metrics
No merged PRs in 30d

Description

Copied from https://github.com/wemake-services/flake8-eradicate/issues/265:

If you paste the following code into a new file, flake8-eradicate will only detect the first and the third code blocks. The second block, split over two lines is not detected.


# create_output_path(*os.path.split(mypath),
#                    overwrite=overwrite,
#                    exist_ok=True)

# create_output_path(*os.path.split(mypath), overwrite=overwrite,
#                    exist_ok=True)

# create_output_path(*os.path.split(mypath), overwrite=overwrite, exist_ok=True)

Repro steps

$ python3.8 -m venv ~/deleteme
$ source ~/deleteme/bin/activate
$ pip install flake8-eradicate
$ flake8 test.py --max-line-length=81

Expected result

Commented out code found on lines 2-4, 6-7, and 9.

Actual result

test.py:3:1: E800 Found commented out code
test.py:9:1: E800 Found commented out code

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

Reproduce the issue by placing the three examples in test.py and running flake8 test.py --max-line-length=81 as shown. Trace how flake8-eradicate handles consecutive commented lines, then make the result detect the commented-out code on lines 2-4, 6-7, and 9.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.