[stem/master] Remove the custom check for trailing whitespace.

commit 268cfe504566d1684c0143f9f32c6c68c5f198bc Author: cypherpunks <cypherpunks@torproject.org> Date: Tue Jul 7 16:33:53 2015 +0200 Remove the custom check for trailing whitespace. The pep8 API has the same check which makes the custom check redundant. Trailing whitespace errors are assigned error code W291. --- run_tests.py | 2 +- stem/util/test_tools.py | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/run_tests.py b/run_tests.py index d82f38a..91c0adf 100755 --- a/run_tests.py +++ b/run_tests.py @@ -78,7 +78,7 @@ PYFLAKES_TASK = Task( PEP8_TASK = Task( 'running pep8', stem.util.test_tools.stylistic_issues, - args = (SRC_PATHS, True, True, True, True), + args = (SRC_PATHS, True, True, True), is_required = False, print_result = False, ) diff --git a/stem/util/test_tools.py b/stem/util/test_tools.py index 2694327..e36f5fa 100644 --- a/stem/util/test_tools.py +++ b/stem/util/test_tools.py @@ -116,7 +116,7 @@ def is_pep8_available(): return False -def stylistic_issues(paths, check_newlines = False, check_trailing_whitespace = False, check_exception_keyword = False, prefer_single_quotes = False): +def stylistic_issues(paths, check_newlines = False, check_exception_keyword = False, prefer_single_quotes = False): """ Checks for stylistic issues that are an issue according to the parts of PEP8 we conform to. You can suppress PEP8 issues by making a 'test' configuration @@ -163,8 +163,6 @@ def stylistic_issues(paths, check_newlines = False, check_trailing_whitespace = :param list paths: paths to search for stylistic issues :param bool check_newlines: check that we have standard newlines (\\n), not windows (\\r\\n) nor classic mac (\\r) - :param bool check_trailing_whitespace: check that our lines don't end with - trailing whitespace :param bool check_exception_keyword: checks that we're using 'as' for exceptions rather than a comma :param bool prefer_single_quotes: standardize on using single rather than @@ -192,7 +190,7 @@ def stylistic_issues(paths, check_newlines = False, check_trailing_whitespace = style_checker = pep8.StyleGuide(ignore = CONFIG['pep8.ignore'], reporter = StyleReport) style_checker.check_files(list(_python_files(paths))) - if check_newlines or check_trailing_whitespace or check_exception_keyword: + if check_newlines or check_exception_keyword: for path in _python_files(paths): with open(path) as f: file_contents = f.read() @@ -212,8 +210,6 @@ def stylistic_issues(paths, check_newlines = False, check_trailing_whitespace = if check_newlines and '\r' in content: issues.setdefault(path, []).append(Issue(index + 1, 'contains a windows newline', line)) - elif check_trailing_whitespace and content != content.rstrip(): - issues.setdefault(path, []).append(Issue(index + 1, 'line has trailing whitespace', line)) elif check_exception_keyword and content.lstrip().startswith('except') and content.endswith(', exc:'): # Python 2.6 - 2.7 supports two forms for exceptions... #
participants (1)
-
atagar@torproject.org