镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Fix regression in E302 detection - #618

Merged
sigmavirus24 merged 2 commits into
PyCQA:masterfrom
sigmavirus24:bug/617
Jan 30, 2017
Merged

sigmavirus24 merged 2 commits into
PyCQA:masterfrom
sigmavirus24:bug/617

Conversation

@sigmavirus24

Copy link
Copy Markdown
Member

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

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
Comment thread pycodestyle.py
@@ -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)')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about this one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all regular expressions named similarly need to be touched all at once. This one is actually fine as is.

Comment thread 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 |@)')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use "\s" to also detect tabs!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you exclaiming this?!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Updated!

@sigmavirus24
sigmavirus24 merged commit 6837433 into PyCQA:master Jan 30, 2017
@sigmavirus24
sigmavirus24 deleted the bug/617 branch January 30, 2017 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants