Fix E251 violations and re-enable gating
E251 got stricter in hacking 0.9, so fix new violations and re-enable gating. Change-Id: Idbc0a85d6204f5707d17f4bfd4d98199c1edb333
This commit is contained in:
parent
c3c4839514
commit
831c303815
@ -74,8 +74,7 @@ class Alarm(base.Model):
|
||||
state_timestamp=state_timestamp,
|
||||
ok_actions=ok_actions,
|
||||
alarm_actions=alarm_actions,
|
||||
insufficient_data_actions=
|
||||
insufficient_data_actions,
|
||||
insufficient_data_actions=insufficient_data_actions,
|
||||
repeat_actions=repeat_actions,
|
||||
rule=rule,
|
||||
time_constraints=time_constraints)
|
||||
|
@ -1461,8 +1461,8 @@ class ResourcesController(rest.RestController):
|
||||
links = [_make_link('self', pecan.request.host_url, 'resources',
|
||||
resource_id)]
|
||||
if meter_links:
|
||||
for meter in pecan.request.storage_conn.get_meters(resource=
|
||||
resource_id):
|
||||
for meter in pecan.request.storage_conn.get_meters(
|
||||
resource=resource_id):
|
||||
query = {'field': 'resource_id', 'value': resource_id}
|
||||
links.append(_make_link(meter.name, pecan.request.host_url,
|
||||
'meters', meter.name, query=query))
|
||||
|
@ -64,9 +64,8 @@ class InstanceScheduled(UserMetadataAwareInstanceNotificationBase):
|
||||
volume=1,
|
||||
unit='instance',
|
||||
user_id=None,
|
||||
project_id=
|
||||
message['payload']['request_spec']
|
||||
['instance_properties']['project_id'],
|
||||
project_id=message['payload']['request_spec']
|
||||
['instance_properties']['project_id'],
|
||||
resource_id=message['payload']['instance_id'],
|
||||
message=message)
|
||||
|
||||
|
@ -677,8 +677,8 @@ class Connection(base.Connection):
|
||||
state_timestamp=row.state_timestamp,
|
||||
ok_actions=row.ok_actions,
|
||||
alarm_actions=row.alarm_actions,
|
||||
insufficient_data_actions=
|
||||
row.insufficient_data_actions,
|
||||
insufficient_data_actions=(
|
||||
row.insufficient_data_actions),
|
||||
rule=row.rule,
|
||||
time_constraints=row.time_constraints,
|
||||
repeat_actions=row.repeat_actions)
|
||||
|
@ -32,8 +32,9 @@ class FakeComplexQuery(api.ValidatedComplexQuery):
|
||||
def __init__(self, db_model, additional_name_mapping=None, metadata=False):
|
||||
super(FakeComplexQuery, self).__init__(query=None,
|
||||
db_model=db_model,
|
||||
additional_name_mapping=
|
||||
additional_name_mapping or {},
|
||||
additional_name_mapping=(
|
||||
additional_name_mapping or
|
||||
{}),
|
||||
metadata_allowed=metadata)
|
||||
|
||||
|
||||
|
@ -773,8 +773,8 @@ class ComplexSampleQueryTest(DBTestBase,
|
||||
|
||||
def test_query_complex_filter(self):
|
||||
self._create_samples()
|
||||
results = list(self.conn.query_samples(filter_expr=
|
||||
self.complex_filter))
|
||||
results = list(self.conn.query_samples(filter_expr=(
|
||||
self.complex_filter)))
|
||||
self.assertEqual(len(results), 6)
|
||||
for sample in results:
|
||||
self.assertIn(sample.resource_id,
|
||||
@ -878,8 +878,8 @@ class ComplexSampleQueryTest(DBTestBase,
|
||||
orderby = [{"counter_volume": "not valid order"},
|
||||
{"resource_id": "desc"}]
|
||||
|
||||
query = lambda: list(self.conn.query_samples(filter_expr=
|
||||
self.complex_filter,
|
||||
query = lambda: list(self.conn.query_samples(filter_expr=(
|
||||
self.complex_filter),
|
||||
orderby=orderby))
|
||||
self.assertRaises(KeyError, query)
|
||||
|
||||
@ -2566,8 +2566,8 @@ class ComplexAlarmQueryTest(AlarmTestBase,
|
||||
|
||||
def test_filter_and_orderby(self):
|
||||
self.add_some_alarms()
|
||||
result = list(self.conn.query_alarms(filter_expr=
|
||||
{"=": {"enabled": True}},
|
||||
result = list(self.conn.query_alarms(filter_expr=(
|
||||
{"=": {"enabled": True}}),
|
||||
orderby=[{"name": "asc"}]))
|
||||
self.assertEqual(2, len(result))
|
||||
self.assertEqual(["orange-alert", "red-alert"],
|
||||
@ -2592,8 +2592,8 @@ class ComplexAlarmHistoryQueryTest(AlarmTestBase,
|
||||
alarms = list(self.conn.get_alarms())
|
||||
for alarm in alarms:
|
||||
i = alarms.index(alarm)
|
||||
alarm_change = dict(event_id=
|
||||
"16fd2706-8baf-433b-82eb-8c7fada847c%s" % i,
|
||||
alarm_change = dict(event_id=(
|
||||
"16fd2706-8baf-433b-82eb-8c7fada847c%s" % i),
|
||||
alarm_id=alarm.alarm_id,
|
||||
type=alarm_models.AlarmChange.CREATION,
|
||||
detail="detail %s" % alarm.name,
|
||||
@ -2605,8 +2605,8 @@ class ComplexAlarmHistoryQueryTest(AlarmTestBase,
|
||||
30 + i))
|
||||
self.conn.record_alarm_change(alarm_change=alarm_change)
|
||||
|
||||
alarm_change2 = dict(event_id=
|
||||
"16fd2706-8baf-433b-82eb-8c7fada847d%s" % i,
|
||||
alarm_change2 = dict(event_id=(
|
||||
"16fd2706-8baf-433b-82eb-8c7fada847d%s" % i),
|
||||
alarm_id=alarm.alarm_id,
|
||||
type=alarm_models.AlarmChange.RULE_CHANGE,
|
||||
detail="detail %s" % i,
|
||||
@ -2635,9 +2635,9 @@ class ComplexAlarmHistoryQueryTest(AlarmTestBase,
|
||||
self.conn.record_alarm_change(alarm_change=alarm_change3)
|
||||
|
||||
if alarm.name in ["red-alert", "yellow-alert"]:
|
||||
alarm_change4 = dict(event_id=
|
||||
alarm_change4 = dict(event_id=(
|
||||
"16fd2706-8baf-433b-82eb-8c7fada847f%s"
|
||||
% i,
|
||||
% i),
|
||||
alarm_id=alarm.alarm_id,
|
||||
type=alarm_models.AlarmChange.DELETION,
|
||||
detail="detail %s" % (i + 2),
|
||||
|
3
tox.ini
3
tox.ini
@ -37,14 +37,13 @@ commands = python setup.py build_sphinx
|
||||
commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
# E251 unexpected spaces around keyword / parameter equals
|
||||
# E265 block comment should start with ‘# ‘
|
||||
# F402 import module shadowed by loop variable
|
||||
# H305 imports not grouped correctly
|
||||
# H307 like imports should be grouped together
|
||||
# H405 multi line docstring summary not separated with an empty line
|
||||
# H904 Wrap long lines in parentheses instead of a backslash
|
||||
ignore = E251,E265,F402,H305,H307,H405,H904
|
||||
ignore = E265,F402,H305,H307,H405,H904
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,./ceilometer/openstack/common,*lib/python*,*egg,tools,nova_tests,build
|
||||
show-source = True
|
||||
|
Loading…
x
Reference in New Issue
Block a user