Skip to content

Commit

Permalink
Remove lint errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
bwendling committed Dec 5, 2018
1 parent eb65a83 commit d1a1b3b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
4 changes: 2 additions & 2 deletions yapf/yapflib/reformatter.py
Expand Up @@ -319,7 +319,7 @@ def _AlignTrailingComments(final_lines):
if line_tok.is_comment:
pc_line_lengths.append(len(line_content))
else:
line_content += "{}{}".format(whitespace_prefix, line_tok.value)
line_content += '{}{}'.format(whitespace_prefix, line_tok.value)

if pc_line_lengths:
max_line_length = max(max_line_length, max(pc_line_lengths))
Expand Down Expand Up @@ -362,7 +362,7 @@ def _AlignTrailingComments(final_lines):

for comment_line_index, comment_line in enumerate(
line_tok.value.split('\n')):
line_content.append("{}{}".format(whitespace,
line_content.append('{}{}'.format(whitespace,
comment_line.strip()))

if comment_line_index == 0:
Expand Down
2 changes: 1 addition & 1 deletion yapf/yapflib/style.py
Expand Up @@ -181,7 +181,7 @@ def method():
SPACES_BEFORE_COMMENT=textwrap.dedent("""\
The number of spaces required before a trailing comment.
This can be a single value (representing the number of spaces
before each trailing comment) or list of of values (representing
before each trailing comment) or list of values (representing
alignment column values; trailing comments within a block will
be aligned to the first column value that is greater than the maximum
line length within the block). For example:
Expand Down
20 changes: 10 additions & 10 deletions yapftests/style_test.py
Expand Up @@ -54,13 +54,13 @@ def testBoolConverter(self):
self.assertEqual(style._BoolConverter('0'), False)

def testIntListConverter(self):
self.assertEqual(style._IntListConverter("1, 2, 3"), [1, 2, 3])
self.assertEqual(style._IntListConverter("[ 1, 2, 3 ]"), [1, 2, 3])
self.assertEqual(style._IntListConverter("[ 1, 2, 3, ]"), [1, 2, 3])
self.assertEqual(style._IntListConverter('1, 2, 3'), [1, 2, 3])
self.assertEqual(style._IntListConverter('[ 1, 2, 3 ]'), [1, 2, 3])
self.assertEqual(style._IntListConverter('[ 1, 2, 3, ]'), [1, 2, 3])

def testIntOrIntListConverter(self):
self.assertEqual(style._IntOrIntListConverter("10"), 10)
self.assertEqual(style._IntOrIntListConverter("1, 2, 3"), [1, 2, 3])
self.assertEqual(style._IntOrIntListConverter('10'), 10)
self.assertEqual(style._IntOrIntListConverter('1, 2, 3'), [1, 2, 3])


def _LooksLikeChromiumStyle(cfg):
Expand All @@ -85,7 +85,7 @@ def _LooksLikeFacebookStyle(cfg):
class PredefinedStylesByNameTest(unittest.TestCase):

@classmethod
def setUpClass(cls):
def setUpClass(cls): # pylint: disable=g-missing-super-call
style.SetGlobalStyle(style.CreatePEP8Style())

def testDefault(self):
Expand Down Expand Up @@ -117,12 +117,12 @@ def testFacebookByName(self):
class StyleFromFileTest(unittest.TestCase):

@classmethod
def setUpClass(cls):
def setUpClass(cls): # pylint: disable=g-missing-super-call
cls.test_tmpdir = tempfile.mkdtemp()
style.SetGlobalStyle(style.CreatePEP8Style())

@classmethod
def tearDownClass(cls):
def tearDownClass(cls): # pylint: disable=g-missing-super-call
shutil.rmtree(cls.test_tmpdir)

def testDefaultBasedOnStyle(self):
Expand Down Expand Up @@ -233,7 +233,7 @@ def testErrorUnknownStyleOption(self):
class StyleFromDict(unittest.TestCase):

@classmethod
def setUpClass(cls):
def setUpClass(cls): # pylint: disable=g-missing-super-call
style.SetGlobalStyle(style.CreatePEP8Style())

def testDefaultBasedOnStyle(self):
Expand All @@ -258,7 +258,7 @@ def testDefaultBasedOnStyleBadDict(self):
class StyleFromCommandLine(unittest.TestCase):

@classmethod
def setUpClass(cls):
def setUpClass(cls): # pylint: disable=g-missing-super-call
style.SetGlobalStyle(style.CreatePEP8Style())

def testDefaultBasedOnStyle(self):
Expand Down
5 changes: 1 addition & 4 deletions yapftests/yapf_test.py
Expand Up @@ -229,7 +229,7 @@ def testFormatFileDiff(self):
""")
with utils.TempFileContents(self.test_tmpdir, unformatted_code) as filepath:
diff, _, _ = yapf_api.FormatFile(filepath, print_diff=True)
self.assertTrue(u'+ pass' in diff)
self.assertIn(u'+ pass', diff)

def testFormatFileInPlace(self):
unformatted_code = u'True==False\n'
Expand Down Expand Up @@ -1453,9 +1453,6 @@ def _Check(self, unformatted_code, expected_formatted_code):
unformatted_code, style_config=style.SetGlobalStyle(self._OwnStyle()))
self.assertEqual(expected_formatted_code, formatted_code)

def setUp(self):
self.maxDiff = None

def testSimple(self):
unformatted_code = textwrap.dedent("""\
foo = '1' # Aligned at first list value
Expand Down

0 comments on commit d1a1b3b

Please sign in to comment.