commit c8cd4fc7f17c239384b1985ae8ae9370367ca394 Author: cypherpunks cypherpunks@torproject.org Date: Tue Jul 7 15:35:07 2015 +0200
Fix the format of PEP8 issue lines.
According to commit d14c2803eca669022a64a5caf16699ce77e2fb70, an issue line consists of three elements; the line number, the error message and the actual line from the file that has the error. This commit fixes PEP8 issue lines where the error message and line were equal.
Additionally, this commit removes the duplicate error code in PEP8 issue lines and adds parentheses around the line to improve readability. --- run_tests.py | 2 +- stem/util/test_tools.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/run_tests.py b/run_tests.py index d988900..47e977c 100755 --- a/run_tests.py +++ b/run_tests.py @@ -326,7 +326,7 @@ def _print_static_issues(static_check_issues): for line_number in sorted(line_to_issues.keys()): for msg, line in line_to_issues[line_number]: line_count = '%-4s' % line_number - println(' line %s - %-40s %s' % (line_count, msg, line.strip())) + println(' line %s - %-40s (%s)' % (line_count, msg, line.strip()))
println()
diff --git a/stem/util/test_tools.py b/stem/util/test_tools.py index d6a81c4..af9c944 100644 --- a/stem/util/test_tools.py +++ b/stem/util/test_tools.py @@ -188,7 +188,8 @@ def stylistic_issues(paths, check_two_space_indents = False, check_newlines = Fa code = super(StyleReport, self).error(line_number, offset, text, check)
if code: - issues.setdefault(self.filename, []).append(Issue(line_number, '%s %s' % (code, text), text)) + line = linecache.getline(self.filename, line_number) + issues.setdefault(self.filename, []).append(Issue(line_number, text, line))
style_checker = pep8.StyleGuide(ignore = CONFIG['pep8.ignore'], reporter = StyleReport) style_checker.check_files(list(_python_files(paths)))
tor-commits@lists.torproject.org