diff --git a/.pylintrc b/.pylintrc index 4467968d55..705f1d2690 100644 --- a/.pylintrc +++ b/.pylintrc @@ -56,9 +56,6 @@ disable= unused-variable, wrong-import-order, # TODO # "R" Refactor recommendations - chained-comparison, - comparison-with-itself, - consider-using-in, cyclic-import, # TODO duplicate-code, inconsistent-return-statements, # TODO diff --git a/horizon/templatetags/truncate_filter.py b/horizon/templatetags/truncate_filter.py index a3d8476058..44d4e2fac5 100644 --- a/horizon/templatetags/truncate_filter.py +++ b/horizon/templatetags/truncate_filter.py @@ -27,6 +27,7 @@ register = template.Library() @register.filter("truncate") def truncate(value, size): + # pylint: disable=chained-comparison if len(value) > size and size > 3: return value[0:(size - 3)] + '...' else: diff --git a/openstack_dashboard/api/keystone.py b/openstack_dashboard/api/keystone.py index 0ca69cfcf0..61d6009d06 100644 --- a/openstack_dashboard/api/keystone.py +++ b/openstack_dashboard/api/keystone.py @@ -899,7 +899,7 @@ def get_default_role(request): roles = [] exceptions.handle(request) for role in roles: - if role.id == default or role.name == default: + if default in (role.id, role.name): DEFAULT_ROLE = role break return DEFAULT_ROLE diff --git a/openstack_dashboard/api/rest/json_encoder.py b/openstack_dashboard/api/rest/json_encoder.py index 91f1561744..789c937747 100644 --- a/openstack_dashboard/api/rest/json_encoder.py +++ b/openstack_dashboard/api/rest/json_encoder.py @@ -58,6 +58,9 @@ class NaNJSONEncoder(json.JSONEncoder): # and/or platform-specific, so do tests which don't depend on the # internals. + # NOTE: In Python, NaN == NaN returns False and it can be used + # to detect NaN. + # pylint: disable=comparison-with-itself if o != o: text = self.nan_str elif o == _inf: diff --git a/openstack_dashboard/dashboards/project/security_groups/forms.py b/openstack_dashboard/dashboards/project/security_groups/forms.py index 58dd2dc4d2..4a551178fa 100644 --- a/openstack_dashboard/dashboards/project/security_groups/forms.py +++ b/openstack_dashboard/dashboards/project/security_groups/forms.py @@ -390,7 +390,7 @@ class AddRule(forms.SelfHandlingForm): rule_menu = cleaned_data.get('rule_menu') if rule_menu == 'icmp': self._clean_rule_icmp(cleaned_data, rule_menu) - elif rule_menu == 'tcp' or rule_menu == 'udp': + elif rule_menu in ('tcp', 'udp'): self._clean_rule_tcp_udp(cleaned_data, rule_menu) elif rule_menu == 'custom': self._clean_rule_custom(cleaned_data, rule_menu)