Allow text before 'pylint' comments.
b/32567870
diff --git a/CHANGELOG b/CHANGELOG
index 9fea465..fe61a18 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@
are skipping dictionary entries. However, we need to ignore comments in our
calculations and implicitly concatenated strings, which are already placed on
separate lines.
+- Allow text before a "pylint" comment.
## [0.14.0] 2016-11-21
#### Added
diff --git a/yapf/yapflib/format_token.py b/yapf/yapflib/format_token.py
index 23fcf00..4e8678a 100644
--- a/yapf/yapflib/format_token.py
+++ b/yapf/yapflib/format_token.py
@@ -277,4 +277,4 @@
@property
def is_pylint_comment(self):
- return self.is_comment and re.match(r'#\s*\bpylint:\b', self.value)
+ return self.is_comment and re.match(r'#.*\bpylint:\s*(disable|enable)=', self.value)
diff --git a/yapftests/reformatter_buganizer_test.py b/yapftests/reformatter_buganizer_test.py
index bae4daf..7a8df04 100644
--- a/yapftests/reformatter_buganizer_test.py
+++ b/yapftests/reformatter_buganizer_test.py
@@ -190,7 +190,7 @@
unformatted_code = textwrap.dedent("""\
class _():
- def aaaaa(self, bbbbb, cccccccccccccc=None): # pylint: disable=unused-argument
+ def aaaaa(self, bbbbb, cccccccccccccc=None): # TODO(who): pylint: disable=unused-argument
return 1
def xxxxx(self, yyyyy, zzzzzzzzzzzzzz=None): # A normal comment that runs over the column limit.
@@ -199,7 +199,7 @@
expected_formatted_code = textwrap.dedent("""\
class _():
- def aaaaa(self, bbbbb, cccccccccccccc=None): # pylint: disable=unused-argument
+ def aaaaa(self, bbbbb, cccccccccccccc=None): # TODO(who): pylint: disable=unused-argument
return 1
def xxxxx(