Fix regression in E302 detection#618
Merged
sigmavirus24 merged 2 commits intoPyCQA:masterfrom Jan 30, 2017
Merged
Conversation
This was similar to an issue we had with E306 in which we were only checking that a line started with "def" or "class" which catches global vars like "defaults" or "classification". Closes PyCQAgh-617
spaceone
reviewed
Jan 30, 2017
| @@ -122,7 +122,7 @@ | |||
| LAMBDA_REGEX = re.compile(r'\blambda\b') | |||
| HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$') | |||
| STARTSWITH_DEF_REGEX = re.compile(r'^(async\s+def|def)') | |||
Member
Author
There was a problem hiding this comment.
Not all regular expressions named similarly need to be touched all at once. This one is actually fine as is.
spaceone
reviewed
Jan 30, 2017
pycodestyle.py
Outdated
| HUNK_REGEX = re.compile(r'^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@.*$') | ||
| STARTSWITH_DEF_REGEX = re.compile(r'^(async\s+def|def)') | ||
| STARTSWITH_TOP_LEVEL_REGEX = re.compile(r'^(async\s+def|def|class|@)') | ||
| STARTSWITH_TOP_LEVEL_REGEX = re.compile(r'^(async\s+def |def |class |@)') |
Contributor
There was a problem hiding this comment.
I would use "\s" to also detect tabs!
Member
Author
There was a problem hiding this comment.
Why are you exclaiming this?!
Member
Author
There was a problem hiding this comment.
Good idea! Updated!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was similar to an issue we had with E306 in which we were only
checking that a line started with "def" or "class" which catches global
vars like "defaults" or "classification".
Closes gh-617