Enable Comparison to None should use 'is' Error

Flake8 currently ignores comparison to None should be 'if cond is None'
Enable E711 for more thorough testing of code

Change-Id: I608cceff2eeb87c116bccddac26e3c869e5d57df
Story: 2004515
Task: 30076
Signed-off-by: Eric Barrett <eric.barrett@windriver.com>
This commit is contained in:
Eric Barrett 2019-03-21 10:00:18 -04:00
parent 01cfb103bc
commit 360ad25564
3 changed files with 4 additions and 5 deletions

View File

@ -1429,7 +1429,7 @@ if __name__ == "__main__":
SERVICES_INFO = tuple(config.get("ApiStatsServices", "API_STATS_STRUCTURE").split('|'))
for service_string in SERVICES_INFO:
service_tuple = tuple(service_string.split(';'))
if service_tuple[2] != "" and service_tuple[2] != None:
if service_tuple[2] != "" and service_tuple[2] is not None:
SERVICES[service_tuple[0]] = {'name': service_tuple[1], 'api-port': service_tuple[2]}
else:
SERVICES[service_tuple[0]] = {'name': service_tuple[1], 'api-port': None}

View File

@ -1510,7 +1510,7 @@ def get_info_and_display(show=None):
q = select([S.name,
S.region_name,
S.deleted_at]
).where(S.deleted_at == None)
).where(S.deleted_at is None)
result = conn.execute(q)
for row in result:
field = 'region_name'
@ -1527,7 +1527,7 @@ def get_info_and_display(show=None):
q = select([S.name,
S.region_name,
S.deleted_at]
).where(S.deleted_at == None)
).where(S.deleted_at is None)
result = conn.execute(q)
for row in result:
name = str(row['name'])

View File

@ -62,7 +62,6 @@ commands =
# E305 expected 2 blank lines after class or function definition, found 1
# E402 module level import not at top of file
# E501 line too long > 80
# E711 comparison to None should be 'if cond is None:'
# E722 do not use bare except'
# E741 ambiguous variable name 'O'
# H series are hacking
@ -90,7 +89,7 @@ commands =
# F401 'module' imported but unused
# F841 local variable '_alarm_state' is assigned to but never used
ignore = E121,E123,E124,E125,E126,E127,E128,E201,E202,E203,E211,E221,E222,E225,E226,E231,E251,E261,E265,E266,
E302,E303,E305,E402,E501,E711,E722,E741,
E302,E303,E305,E402,E501,E722,E741,
H101,H102,H104,H201,H238,H237,H306,H401,H404,H405,
W191,W291,W391,W503,
B001,B007,B301,B306,