From a0be1593f5b7828b0250eefabe45d3282f3dc1e6 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Sat, 30 Nov 2013 10:40:34 -0500 Subject: [PATCH] Fix E122,E126,E128 items in codebase In the land of random cleanups, let more of the whitespace rules back in. Also explicitly exclude E125 because of the overreach, and leave E123 excluded because it creates some kind of odd artifacts in the current code (possibly clean it up later). Tox.ini adjusted with comments about the fact that what we are ignoring is there for a reason. Change-Id: I5636cb646d7898df71b715aa0e32a68ce279ee80 --- elastic_recheck/elasticRecheck.py | 16 ++++++++-------- elastic_recheck/tests/functional/test_queries.py | 5 +++-- elastic_recheck/tests/unit/test_classifier.py | 16 +++++++++++----- tox.ini | 4 +++- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/elastic_recheck/elasticRecheck.py b/elastic_recheck/elasticRecheck.py index ea0fca05..38a0d307 100755 --- a/elastic_recheck/elasticRecheck.py +++ b/elastic_recheck/elasticRecheck.py @@ -33,14 +33,14 @@ logging.basicConfig() REQUIRED_FILES = [ - 'console.html', - 'logs/screen-n-api.txt', - 'logs/screen-n-cpu.txt', - 'logs/screen-n-sch.txt', - 'logs/screen-c-api.txt', - 'logs/screen-c-vol.txt', - 'logs/syslog.txt', - ] + 'console.html', + 'logs/screen-n-api.txt', + 'logs/screen-n-cpu.txt', + 'logs/screen-n-sch.txt', + 'logs/screen-c-api.txt', + 'logs/screen-c-vol.txt', + 'logs/syslog.txt', +] class Stream(object): diff --git a/elastic_recheck/tests/functional/test_queries.py b/elastic_recheck/tests/functional/test_queries.py index e7d58f01..c63d4781 100644 --- a/elastic_recheck/tests/functional/test_queries.py +++ b/elastic_recheck/tests/functional/test_queries.py @@ -42,8 +42,9 @@ class TestQueries(tests.TestCase): for x in self.classifier.queries: print("Looking for bug: https://bugs.launchpad.net/bugs/%s" % x['bug']) - self.assertTrue((self._is_valid_ElasticSearch_query(x) or - self._is_valid_launchpad_bug(x['bug'])), + self.assertTrue( + (self._is_valid_ElasticSearch_query(x) or + self._is_valid_launchpad_bug(x['bug'])), ("Something is wrong with bug %s" % x['bug'])) def _is_valid_ElasticSearch_query(self, x): diff --git a/elastic_recheck/tests/unit/test_classifier.py b/elastic_recheck/tests/unit/test_classifier.py index 9c4c5368..cc7bb6ff 100644 --- a/elastic_recheck/tests/unit/test_classifier.py +++ b/elastic_recheck/tests/unit/test_classifier.py @@ -77,16 +77,22 @@ class TestClassifier(tests.TestCase): def test_is_ready(self): self.stubs.Set(self.classifier.es, 'search', _fake_search) - result = self.classifier._is_ready('49282', '3', 'BLAH http://logs.' - 'openstack.org/57/51057/1/gate/gate-tempest-devstack-vm-full' - '/f8965ee') + result = self.classifier._is_ready( + '49282', + '3', + 'BLAH http://logs.openstack.org/57/51057/1/gate/' + 'gate-tempest-devstack-vm-full/f8965ee' + ) self.assertTrue(result) def test_classify(self): self.stubs.Set(self.classifier.es, 'search', _fake_search) self.stubs.Set(self.classifier, '_urls_match', _fake_urls_match) self.stubs.Set(self.classifier, '_is_ready', _fake_is_ready) - bug_numbers = self.classifier.classify('47463', '3', + bug_numbers = self.classifier.classify( + '47463', + '3', ' blah http://logs.openstack.org/63/47463/3/gate/gate-tempest' - '-devstack-vm-postgres-full/99bb8f6') + '-devstack-vm-postgres-full/99bb8f6' + ) self.assertEqual(bug_numbers, [1234567]) diff --git a/tox.ini b/tox.ini index dddff947..6a1de2a0 100644 --- a/tox.ini +++ b/tox.ini @@ -29,6 +29,8 @@ commands = python setup.py testr --coverage --testr-args='{posargs}' [flake8] # H803 Skipped on purpose +# E125 Skipped because it's an overreach (and anti-emacs) +# E123 Skipped because it decreases clarity in many cases -ignore = E123,E122,E126,E128,H803 +ignore = E123,E125,H803 exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build