Skip to content

Commit

Permalink
Fix newline after printing "No issues detected" during check mode (#53)
Browse files Browse the repository at this point in the history
* Fix newline after printing "No issues detected" during check mode

In check mode, we print "No issue detected" after checking a file, and if that file contains no errors. This leads to lines like:

No issues detected!No issues detected!No issues detected!

Add a \n to make this slightly better.

* Update expected output in unit tests
  • Loading branch information
sargun authored and myint committed Jun 2, 2019
1 parent 68fea68 commit efcda0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion autoflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ def fix_file(filename, args, standard_out):
standard_out.write(''.join(diff))
else:
if args.check:
standard_out.write('No issues detected!')
standard_out.write('No issues detected!\n')


def open_with_encoding(filename, encoding, mode='r',
Expand Down
4 changes: 2 additions & 2 deletions test_autoflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ def test_check_with_empty_file(self):
autoflake._main(argv=['my_fake_program', '--check', filename],
standard_out=output_file,
standard_error=None)
self.assertEqual('No issues detected!', output_file.getvalue())
self.assertEqual('No issues detected!\n', output_file.getvalue())

def test_check_correct_file(self):
with temporary_file("""\
Expand All @@ -1374,7 +1374,7 @@ def test_check_correct_file(self):
autoflake._main(argv=['my_fake_program', '--check', filename],
standard_out=output_file,
standard_error=None)
self.assertEqual('No issues detected!', output_file.getvalue())
self.assertEqual('No issues detected!\n', output_file.getvalue())

def test_check_useless_pass(self):
with temporary_file("""\
Expand Down

0 comments on commit efcda0c

Please sign in to comment.