E228: Check only detects missing whitespace around % when both sides are missing
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.2k
- Forks
- 754
- PR merge metrics
- No merged PRs in 30d
Description
At the moment "sometext %s"%"testing will be detected by E228. This is correct.
At the moment "sometext %s" %"testing will not be detected by E228. This is not correct.
Because of the description of E228 (missing whitespace around modulo operator) the check has to detect missing whitespaces on the left site and on the right site of the modulo operator.
At the moment E228 only detects missing whitespaces on the left site of the modulo operator.
Tested with latest PEP8 version (1.5.7).
% cat testing
"sometext %s"%"testing"
sometext %s" %"testing"
sometext %s" % "testing"
% pep8 --select E228 testing
testing:1:14: E228 missing whitespace around modulo operator
E225 is working like expected:
% pep8 --select E225 testing
testing:2:11: E225 missing whitespace around operator
testing:3:11: E225 missing whitespace around operator
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
Reproduce the examples from the issue with pep8 --select E228 testing, then locate the E228 checker in the pycodestyle source. Verify how it handles whitespace on each side of %, and add or update coverage for the three shown expressions. Done means both one-sided omissions are reported while the fully spaced expression remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100