diff --git a/.pylintrc b/.pylintrc index 4f81533c..f493fbd3 100644 --- a/.pylintrc +++ b/.pylintrc @@ -6,19 +6,15 @@ jobs = 0 disable = # TODO(ssbarnea): remove temporary skips adding during initial adoption: broad-except, - dangerous-default-value, duplicate-code, fixme, - function-redefined, global-statement, - inconsistent-return-statements, invalid-name, line-too-long, missing-class-docstring, missing-function-docstring, missing-module-docstring, no-member, - no-self-use, protected-access, redefined-outer-name, super-init-not-called, diff --git a/elastic_recheck/cmd/cleanup.py b/elastic_recheck/cmd/cleanup.py index 1877ede3..9dd0a19f 100644 --- a/elastic_recheck/cmd/cleanup.py +++ b/elastic_recheck/cmd/cleanup.py @@ -141,6 +141,7 @@ def main(): if not cleaned: cleaned.append('None') info('%sRemoved queries:\n%s' % (prefix, '\n'.join(sorted(cleaned)))) + return 0 if __name__ == "__main__": diff --git a/elastic_recheck/elasticRecheck.py b/elastic_recheck/elasticRecheck.py index f99a0fb9..60e79e5e 100644 --- a/elastic_recheck/elasticRecheck.py +++ b/elastic_recheck/elasticRecheck.py @@ -105,7 +105,6 @@ class FailEvent(object): rev = None project = None url = None - build_short_uuids = [] comment = None failed_jobs = [] diff --git a/elastic_recheck/results.py b/elastic_recheck/results.py index bdefff46..b1fa410b 100644 --- a/elastic_recheck/results.py +++ b/elastic_recheck/results.py @@ -117,10 +117,10 @@ class ResultSet(list): (pyes goes way overboard with nesting, which is fine in the general case, but in the elastic_recheck case is just added complexity). """ - def __init__(self, results={}): - self._results = results - if 'hits' in results: - self._parse_hits(results['hits']) + def __init__(self, results=None): + self._results = results or {} + if 'hits' in self._results: + self._parse_hits(self._results['hits']) def _parse_hits(self, hits): # why, oh why elastic search @@ -139,6 +139,7 @@ class ResultSet(list): return self._results['facets']['tag'][attr] if attr in self._results: return self._results[attr] + raise AttributeError(attr) class FacetSet(dict): @@ -153,7 +154,8 @@ class FacetSet(dict): Treat this basically like a dictionary (which it inherits from). """ - def _histogram(self, data, facet, res=3600): + @staticmethod + def _histogram(data, facet, res=3600): """A preprocessor for data should we want to bucket it.""" # NOTE(mriedem): We sometimes hit a case where the @timestamp attribute # is too large and ES won't return it. At some point we should probably diff --git a/elastic_recheck/tests/unit/test_bot.py b/elastic_recheck/tests/unit/test_bot.py index b2b5dab5..653cb809 100644 --- a/elastic_recheck/tests/unit/test_bot.py +++ b/elastic_recheck/tests/unit/test_bot.py @@ -118,7 +118,8 @@ class TestBotWithTestTools(tests.TestCase): "gate-keystone-python27: unrecognized error") self.assertEqual(reference, msg) - def fake_display(self, *args): + @staticmethod + def fake_display(*args): return True def test_error_found(self):