Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: flake8-abp/flake8_abp.py

Issue 29371619: Noissue - Fix E305 by adapting flake8-abp to use groups, run tests on Python 3.6 (Closed)
Patch Set: Created Jan. 12, 2017, 3:22 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | flake8-abp/setup.py » ('j') | flake8-abp/tox.ini » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: flake8-abp/flake8_abp.py
===================================================================
--- a/flake8-abp/flake8_abp.py
+++ b/flake8-abp/flake8_abp.py
@@ -25,6 +25,7 @@
import __builtin__ as builtins
import pkg_resources
+import flake8
try:
ascii
@@ -354,9 +355,6 @@
class ASTChecker(object):
- name = 'abp'
- version = __version__
-
def __init__(self, tree, filename):
self.tree = tree
@@ -372,9 +370,6 @@
if line_number <= 2 and re.search(r'^\s*#.*coding[:=]', physical_line):
return (0, 'A303 non-default file encoding')
-check_non_default_encoding.name = 'abp-non-default-encoding'
Sebastian Noack 2017/01/12 15:55:03 With flake8 3.2.0, it begun to use pycodestyle 2.2
-check_non_default_encoding.version = __version__
-
def check_quotes(logical_line, tokens, previous_logical, checker_state):
first_token = True
@@ -427,9 +422,6 @@
first_token = False
-check_quotes.name = 'abp-quotes'
-check_quotes.version = __version__
-
def check_redundant_parenthesis(logical_line, tokens):
start_line = tokens[0][2][0]
@@ -481,5 +473,13 @@
return []
-check_redundant_parenthesis.name = 'abp-redundant-parenthesis'
-check_redundant_parenthesis.version = __version__
+
+# With flake8 3, the way the entry points are register in setup.py,
+# they are recognized as a group, and the name and version is detected
+# automatically. For compatibility with flake8 2, however, we need to
+# assign the name and version to each checker individually.
+if int(flake8.__version__.split('.')[0]) < 3:
Sebastian Noack 2017/01/12 15:55:03 We could theoretically skip this check and assign
Vasily Kuznetsov 2017/01/12 16:08:51 Acknowledged.
+ for checker in [ASTChecker, check_non_default_encoding,
+ check_quotes, check_redundant_parenthesis]:
+ checker.name = 'abp'
+ checker.version = __version__
« no previous file with comments | « no previous file | flake8-abp/setup.py » ('j') | flake8-abp/tox.ini » ('J')

Powered by Google App Engine
This is Rietveld