From e79dcfae87e79423165fa8510190de6565abdf07 Mon Sep 17 00:00:00 2001 From: Kristine Bujold Date: Wed, 21 Nov 2018 16:53:55 -0500 Subject: [PATCH] Enable zuul unit tests for stx-gui Enable pylint and fix tox errors resulting from that. Story: 2003863 Task: 27931 Change-Id: I3455f29ec182ed91966d4724cf49dceb314a1387 Signed-off-by: Kristine Bujold --- .zuul.yaml | 14 ++ pylint.rc | 224 ++++++++++++++++++ starlingx-dashboard/centos/build_srpm.data | 2 +- .../starlingx_dashboard/api/neutron.py | 12 +- .../starlingx_dashboard/api/patch.py | 8 +- .../admin/fault_management/tables.py | 2 +- .../dashboards/admin/fault_management/tabs.py | 10 +- .../admin/fault_management/views.py | 2 +- .../dashboards/admin/host_topology/tabs.py | 6 +- .../admin/inventory/devices/views.py | 6 +- .../admin/inventory/memories/forms.py | 4 +- .../inventory/storages/lvg_params/forms.py | 2 +- .../inventory/storages/lvg_params/views.py | 2 +- .../dashboards/admin/inventory/workflows.py | 7 +- .../providernets/providernets/ranges/forms.py | 2 +- .../admin/providernets/providernets/views.py | 2 +- .../dashboards/admin/server_groups/forms.py | 2 +- .../dashboards/admin/server_groups/views.py | 2 +- .../dashboards/admin/system_config/views.py | 1 - .../dashboards/dc_admin/dashboard.py | 2 +- .../dc_admin/dc_software_management/tables.py | 2 +- .../project/server_groups/tables.py | 3 - .../dashboards/project/server_groups/views.py | 2 +- .../horizon/tables/__init__.py | 4 +- tox.ini | 22 ++ 25 files changed, 301 insertions(+), 44 deletions(-) create mode 100755 pylint.rc diff --git a/.zuul.yaml b/.zuul.yaml index bd858325..5a377c17 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -7,12 +7,26 @@ - build-openstack-releasenotes - openstack-tox-pep8 - openstack-tox-linters + - stx-gui-pylint gate: jobs: - build-openstack-releasenotes - openstack-tox-pep8 - openstack-tox-linters + - stx-gui-pylint post: jobs: - publish-stx-tox - publish-stx-releasenotes + +- job: + name: stx-gui-pylint + parent: openstack-tox-pylint + description: Run pylint for stx-gui + vars: + tox_envlist: pylint + required-projects: + - openstack/stx-config + - openstack/stx-fault + - openstack/stx-update + - openstack/stx-nfv \ No newline at end of file diff --git a/pylint.rc b/pylint.rc new file mode 100755 index 00000000..0368d4c5 --- /dev/null +++ b/pylint.rc @@ -0,0 +1,224 @@ +[MASTER] +# Specify a configuration file. +rcfile=pylint.rc + +# Python code to execute, usually for sys.path manipulation such as pygtk.require(). +#init-hook= + +# Add files or directories to the blacklist. They should be base names, not paths. +#ignore= + +# Pickle collected data for later comparisons. +persistent=yes + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + + +[MESSAGES CONTROL] +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time. +#enable= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). +# W0201 attribute-defined-outside-init +# W0212 protected-access var starting with _ used outside class or descendant +# W0221 arguments-differ +# W0222 signature-differs +# W0235 useless-super-delegation +# W0403 relative-import warning +# W0511 fixme +# W0613 Unused argument warning +# W0703 broad except warning +# E0202 method-hidden +# E0203 access-member-before-definition +# E1101 no-member +disable=C, R, W0201, W0212, W0221, W0222, W0235, W0403, W0511, W0613, W0703, + E0202, E0203, E1101 + + +[REPORTS] +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html +output-format=text + +# Put messages in a separate file for each module / package specified on the +# command line instead of printing them on stdout. Reports (if any) will be +# written in a file name "pylint_global.[txt|html]". +files-output=no + +# Tells whether to display a full report or only the messages +reports=no + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + + +[SIMILARITIES] +# Minimum lines number of a similarity. +min-similarity-lines=4 + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + + +[FORMAT] +# Maximum number of characters on a single line. +max-line-length=85 + +# Maximum number of lines in a module +max-module-lines=1000 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 tab). +indent-string=' ' + + +[TYPECHECK] +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# List of classes names for which member attributes should not be checked +# (useful for classes with attributes dynamically set). +ignored-classes=SQLObject,sqlalchemy,scoped_session,_socketobject,ObjectData,GuestService,Network,SwUpdate + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E0201 when accessed. Python regular +# expressions are accepted. +generated-members=REQUEST,acl_users,aq_parent + +[BASIC] +# List of builtins function names that should not be used, separated by a comma +bad-functions=map,filter,apply,input + +# Regular expression which should only match correct module names +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ + +# Regular expression which should only match correct module level names +const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ + +# Regular expression which should only match correct class names +class-rgx=[A-Z_][a-zA-Z0-9]+$ + +# Regular expression which should only match correct function names +function-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct method names +method-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct instance attribute names +attr-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct argument names +argument-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct variable names +variable-rgx=[a-z_][a-z0-9_]{2,30}$ + +# Regular expression which should only match correct list comprehension / +# generator expression variable names +inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ + +# Good variable names which should always be accepted, separated by a comma +good-names=i,j,k,ex,Run,_ + +# Bad variable names which should always be refused, separated by a comma +bad-names=foo,bar,baz,toto,tutu,tata + +# Regular expression which should only match functions or classes name which do +# not require a docstring +no-docstring-rgx=__.*__ + + +[MISCELLANEOUS] +# List of note tags to take in consideration, separated by a comma. +notes=FIXME,XXX,TODO + + +[VARIABLES] +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# A regular expression matching the beginning of the name of dummy variables +# (i.e. not used). +dummy-variables-rgx=_|dummy + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + + +[IMPORTS] +# Deprecated modules which should not be used, separated by a comma +deprecated-modules=regsub,string,TERMIOS,Bastion,rexec + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled) +import-graph= + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled) +ext-import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled) +int-import-graph= + + +[DESIGN] +# Maximum number of arguments for function / method +max-args=5 + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore +ignored-argument-names=_.* + +# Maximum number of locals for function / method body +max-locals=15 + +# Maximum number of return / yield for function / method body +max-returns=6 + +# Maximum number of branch for function / method body +max-branchs=12 + +# Maximum number of statements in function / method body +max-statements=50 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + + +[CLASSES] +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__,__new__,setUp + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + + +[EXCEPTIONS] +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception" +overgeneral-exceptions=Exception diff --git a/starlingx-dashboard/centos/build_srpm.data b/starlingx-dashboard/centos/build_srpm.data index 1bec0cd8..4f322859 100644 --- a/starlingx-dashboard/centos/build_srpm.data +++ b/starlingx-dashboard/centos/build_srpm.data @@ -1,2 +1,2 @@ SRC_DIR="starlingx-dashboard" -TIS_PATCH_VER=17 +TIS_PATCH_VER=20 diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/neutron.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/neutron.py index 0b15a5bd..92efa6fb 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/neutron.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/neutron.py @@ -64,9 +64,9 @@ def provider_network_modify(request, providernet_id, **kwargs): def provider_network_range_create(request, **kwargs): body = {'providernet_range': kwargs} - range = neutronclient(request).create_providernet_range(body=body).get( + _range = neutronclient(request).create_providernet_range(body=body).get( 'providernet_range') - return ProviderNetworkRange(range) + return ProviderNetworkRange(_range) def provider_network_range_list(request, **params): @@ -77,9 +77,9 @@ def provider_network_range_list(request, **params): def provider_network_range_get(request, range_id, expand_subnet=True, **params): - range = neutronclient(request).show_providernet_range( + _range = neutronclient(request).show_providernet_range( range_id, **params).get('providernet_range') - return ProviderNetworkRange(range) + return ProviderNetworkRange(_range) def provider_network_range_delete(request, range_id): @@ -88,9 +88,9 @@ def provider_network_range_delete(request, range_id): def provider_network_range_modify(request, range_id, **kwargs): body = {'providernet_range': kwargs} - range = neutronclient(request).update_providernet_range( + _range = neutronclient(request).update_providernet_range( range_id, body=body).get('providernet_range') - return ProviderNetworkRange(range) + return ProviderNetworkRange(_range) def qos_list(request): diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/patch.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/patch.py index 4738936b..3b80c62d 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/patch.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/patch.py @@ -64,8 +64,8 @@ class Client(object): return self._make_request(self.token_id, "GET", self.version, "query_hosts") - def upload(self, file): - encoder = MultipartEncoder(fields=file) + def upload(self, patchfile): + encoder = MultipartEncoder(fields=patchfile) return self._make_request(self.token_id, "POST", self.version, "upload", encoder=encoder) @@ -206,8 +206,8 @@ def get_message(data): def upload_patch(request, patchfile, name): - file = {'file': (name, patchfile,)} - resp = _patching_client(request).upload(file) + _file = {'file': (name, patchfile,)} + resp = _patching_client(request).upload(_file) return get_message(resp) diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/tables.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/tables.py index 97e2c764..7c5db5c8 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/tables.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/tables.py @@ -244,7 +244,7 @@ class UnsuppressEvent(tables.BatchAction): class EventsSuppressionTable(tables.DataTable): # noinspection PyMethodParameters - def description_inject(row_data): + def description_inject(row_data): # pylint: disable=no-self-argument description = \ escape_html(str(row_data.description)).replace("\n", "
") description = description.replace("\t", "    ") diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/tabs.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/tabs.py index 6e10744d..d7c0610e 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/tabs.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/tabs.py @@ -115,7 +115,7 @@ class ActiveAlarmsTab(tabs.TableTab): search_opts = {} # get retrieve parameters from request/session env limit = \ - self.request.GET.get(tables.AlarmsTable._meta.limit_param, + self.request.GET.get(tables.AlarmsTable.Meta.limit_param, None) search_opts = self.get_filters() @@ -150,8 +150,8 @@ class ActiveAlarmsTab(tabs.TableTab): event_types = self.tab_group.kwargs['suppression_list'] except Exception: exceptions.handle(self.request, - _('Unable to retrieve event suppression table \ ' - 'list.')) + _('Unable to retrieve event suppression table' + ' list.')) return event_types @@ -236,10 +236,10 @@ class EventLogTab(tabs.TableTab): # get retrieve parameters from request/session env marker = \ - self.request.GET.get(tables.EventLogsTable._meta.pagination_param, + self.request.GET.get(tables.EventLogsTable.Meta.pagination_param, None) limit = \ - self.request.GET.get(tables.EventLogsTable._meta.limit_param, + self.request.GET.get(tables.EventLogsTable.Meta.limit_param, None) search_opts = self.get_filters({'marker': marker, 'limit': limit, diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/views.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/views.py index 9278c5e9..0b46f490 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/views.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/fault_management/views.py @@ -135,7 +135,7 @@ class BannerView(TemplateView): template_name = 'header/_alarm_banner.html' def get_context_data(self, **kwargs): - context = super(TemplateView, self).get_context_data(**kwargs) + context = super(BannerView, self).get_context_data(**kwargs) if not self.request.is_ajax(): raise exceptions.NotFound() diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/host_topology/tabs.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/host_topology/tabs.py index e64b2031..0ed3723a 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/host_topology/tabs.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/host_topology/tabs.py @@ -28,9 +28,9 @@ LOG = logging.getLogger(__name__) def get_alarms_for_entity(alarms, entity_str): matched = [] for alarm in alarms: - for id in alarm.entity_instance_id.split('.'): + for _id in alarm.entity_instance_id.split('.'): try: - if entity_str == id.split('=')[1]: + if entity_str == _id.split('=')[1]: matched.append(alarm) except Exception: # malformed entity_instance_id @@ -73,7 +73,7 @@ class OverviewTab(tabs.TableTab): def _get_tenant_list(self): if not hasattr(self, "_tenants"): try: - tenants, has_more = api.keystone.tenant_list(self.request) + tenants, has_more = api.keystone.tenant_list(self.request) # noqa pylint: disable=unused-variable except Exception: tenants = [] msg = _('Unable to retrieve instance project information.') diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/devices/views.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/devices/views.py index 6aeb63c4..3224e566 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/devices/views.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/devices/views.py @@ -140,10 +140,10 @@ class UsageView(tables.MultiTableView): try: _object = stx_api.nova.get_detail_usage(self.request, dev_id) _object.sort(key=lambda f: (f.host)) - id = 0 + _id = 0 for u in _object: - id += 1 - u.id = id + _id += 1 + u.id = _id self._detail_object = _object except Exception: diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/memories/forms.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/memories/forms.py index 845a819d..063cda64 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/memories/forms.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/memories/forms.py @@ -269,10 +269,12 @@ class UpdateMemory(forms.SelfHandlingForm): try: for nd in node: node_found = False + memory = None for m in self.host.memorys: for n in self.host.nodes: if m.inode_uuid == n.uuid: if int(n.numa_node) == int(node.index(nd)): + memory = m node_found = True break if node_found: @@ -288,7 +290,7 @@ class UpdateMemory(forms.SelfHandlingForm): new_data['vm_hugepages_nr_1G_pending'] = pages_1G[nd] if new_data: - stx_api.sysinv.host_memory_update(request, m.uuid, + stx_api.sysinv.host_memory_update(request, memory.uuid, **new_data) else: diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/forms.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/forms.py index b7a640aa..c8207b19 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/forms.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/forms.py @@ -296,7 +296,7 @@ class ParamForm(ParamMixin, forms.SelfHandlingForm): return data def get_context_data(self, **kwargs): - context = super(EditParam, self).get_context_data(**kwargs) + context = super(ParamForm, self).get_context_data(**kwargs) context.update(self._lvg) return context diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/views.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/views.py index 979628fc..a6c97378 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/views.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/storages/lvg_params/views.py @@ -24,7 +24,7 @@ class EditView(forms.ModalFormView): success_url = 'horizon:admin:inventory:localvolumegroupdetail' def get_form(self, form_class): - self.form = super(self.__class__, self).get_form(form_class) + self.form = super(EditView, self).get_form(form_class) return self.form def get_context_data(self, **kwargs): diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/workflows.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/workflows.py index a9ceedc5..20595781 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/workflows.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/workflows.py @@ -124,10 +124,9 @@ def profile_get_uuid(request, profilename): for iprofile in profiles: if iprofile.profilename == profilename: - break - else: - raise forms.ValidationError("Profile not found: %s" % profilename) - return iprofile.uuid + return iprofile.uuid + + raise forms.ValidationError("Profile not found: %s" % profilename) class AddHostInfoAction(workflows.Action): diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/forms.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/forms.py index ae90ae99..20bb226d 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/forms.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/providernets/providernets/ranges/forms.py @@ -103,7 +103,7 @@ class CreateProviderNetworkRange(forms.SelfHandlingForm): **kwargs) tenant_choices = [('', _("Select a project"))] - tenants, has_more = api.keystone.tenant_list(request) + tenants, has_more = api.keystone.tenant_list(request) # noqa pylint: disable=unused-variable for tenant in tenants: if tenant.enabled: tenant_choices.append((tenant.id, tenant.name)) diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/providernets/providernets/views.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/providernets/providernets/views.py index 7cfd1a5d..fa222bbd 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/providernets/providernets/views.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/providernets/providernets/views.py @@ -58,7 +58,7 @@ class DetailView(tables.MultiTableView): def _get_tenant_list(self): if not hasattr(self, "_tenants"): try: - tenants, has_more = api.keystone.tenant_list(self.request) + tenants, has_more = api.keystone.tenant_list(self.request) # noqa pylint: disable=unused-variable except Exception: tenants = [] msg = _('Unable to retrieve instance project information.') diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/server_groups/forms.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/server_groups/forms.py index 993a41db..18ea821e 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/server_groups/forms.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/server_groups/forms.py @@ -78,7 +78,7 @@ class CreateForm(forms.SelfHandlingForm): all_projects = [] try: # Get list of available projects. - all_projects, has_more = api.keystone.tenant_list(request) + all_projects, has_more = api.keystone.tenant_list(request) # noqa pylint: disable=unused-variable projects_list = [(project.id, project.name) for project in all_projects] diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/server_groups/views.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/server_groups/views.py index 84cd7331..829423a5 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/server_groups/views.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/server_groups/views.py @@ -106,7 +106,7 @@ class EditAttachmentsView(tables.DataTableView, forms.ModalFormView): def get_initial(self): try: - instances, has_more = api.nova.server_list(self.request) + instances, has_more = api.nova.server_list(self.request) # noqa pylint: disable=unused-variable except Exception: instances = [] exceptions.handle(self.request, diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/system_config/views.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/system_config/views.py index a561a14c..8884b958 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/system_config/views.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/system_config/views.py @@ -6,7 +6,6 @@ import logging -from django.core.urlresolvers import reverse # noqa from django.core.urlresolvers import reverse_lazy from django.utils.translation import ugettext_lazy as _ diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dashboard.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dashboard.py index cc8ee020..29052104 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dashboard.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dashboard.py @@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _ import horizon # Load the api rest services into Horizon -import starlingx_dashboard.api.rest # noqa +import starlingx_dashboard.api.rest # noqa: F401 pylint: disable=unused-import class DCAdmin(horizon.Dashboard): diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_software_management/tables.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_software_management/tables.py index df3cc8cc..3fd5dd51 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_software_management/tables.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/dc_admin/dc_software_management/tables.py @@ -7,7 +7,7 @@ import logging from django.core.urlresolvers import reverse # noqa -from django.template.defaultfilters import safe, title # noqa +from django.template.defaultfilters import safe from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/project/server_groups/tables.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/project/server_groups/tables.py index 2431d105..635217b3 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/project/server_groups/tables.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/project/server_groups/tables.py @@ -39,7 +39,6 @@ DELETABLE_STATES = ("available", "error") class DeleteServerGroup(tables.DeleteAction): data_type_singular = _("Server Group") data_type_plural = _("Server Groups") - action_past = _("Scheduled deletion of") @staticmethod def action_present(count): @@ -213,8 +212,6 @@ class ServerGroupsTable(tables.DataTable): class DetachServerGroup(tables.BatchAction): name = "detach" - action_present = _("Detach") - action_past = _("Detaching") # This action is asynchronous. data_type_singular = _("Server Group") data_type_plural = _("Server Groups") classes = ('btn-danger', 'btn-detach') diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/project/server_groups/views.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/project/server_groups/views.py index afedd7d9..fcf04fcb 100755 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/project/server_groups/views.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/project/server_groups/views.py @@ -106,7 +106,7 @@ class EditAttachmentsView(tables.DataTableView, forms.ModalFormView): def get_initial(self): try: - instances, has_more = api.nova.server_list(self.request) + instances, has_more = api.nova.server_list(self.request) # noqa pylint: disable=unused-variable except Exception: instances = [] exceptions.handle(self.request, diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/horizon/tables/__init__.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/horizon/tables/__init__.py index 466236a4..aa24c89a 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/horizon/tables/__init__.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/horizon/tables/__init__.py @@ -1,2 +1,2 @@ -from starlingx_dashboard.stx_horizon.tables.actions import FixedWithQueryFilter # noqa -from starlingx_dashboard.stx_horizon.tables.actions import LimitAction # noqa +from starlingx_dashboard.horizon.tables.actions import FixedWithQueryFilter # noqa +from starlingx_dashboard.horizon.tables.actions import LimitAction # noqa diff --git a/tox.ini b/tox.ini index 3477aa5f..0e008536 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,7 @@ envlist = pep8 minversion = 2.3 skipsdist = True +stxdir = {toxinidir}/.. [testenv] install_command = pip install -U {opts} {packages} @@ -54,6 +55,27 @@ deps = commands = flake8 +[testenv:pylint] +basepython = python2.7 +usedevelop = False +skip_install = True +deps = {[testenv]deps} + git+git://github.com/starlingx-staging/stx-python-novaclient.git + git+git://github.com/starlingx-staging/stx-python-neutronclient.git + git+git://github.com/starlingx-staging/stx-horizon.git + git+git://github.com/starlingx-staging/stx-distcloud-client.git + -e{[tox]stxdir}/stx-config/sysinv/cgts-client/cgts-client + -e{[tox]stxdir}/stx-config/sysinv/sysinv/sysinv + -e{[tox]stxdir}/stx-fault/python-fmclient/fmclient + -e{[tox]stxdir}/stx-update/cgcs-patch/cgcs-patch + -e{[tox]stxdir}/stx-nfv/nfv/nfv-client + requests-toolbelt + pylint +commands = + pylint --rcfile=./pylint.rc --version + pylint starlingx-dashboard/starlingx-dashboard/starlingx_dashboard \ + --rcfile=./pylint.rc + [testenv:venv] basepython = python3 commands = {posargs}