From d32427f4148ff2dc3430d7dfbab4b514d47da298 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Fri, 27 Apr 2018 14:54:44 +0200 Subject: [PATCH] mgr/dashboard: Clean up Pylint warnings * Enabled warnings that actually make sense * Enabled `fixme` as we only have two left. * Removed disable statements that use warning-ids * Removed disable statements that are no longer needed Signed-off-by: Sebastian Wagner --- src/pybind/mgr/dashboard/.pylintrc | 19 +------------------ .../mgr/dashboard/controllers/__init__.py | 3 +-- .../mgr/dashboard/controllers/cephfs.py | 2 -- .../mgr/dashboard/controllers/dashboard.py | 1 - src/pybind/mgr/dashboard/controllers/rbd.py | 1 - .../dashboard/controllers/rbd_mirroring.py | 2 +- src/pybind/mgr/dashboard/tests/helper.py | 3 ++- src/pybind/mgr/dashboard/tests/test_tools.py | 3 +-- src/pybind/mgr/dashboard/tools.py | 5 +++-- 9 files changed, 9 insertions(+), 30 deletions(-) diff --git a/src/pybind/mgr/dashboard/.pylintrc b/src/pybind/mgr/dashboard/.pylintrc index 96f88facc3f..be857f8482f 100644 --- a/src/pybind/mgr/dashboard/.pylintrc +++ b/src/pybind/mgr/dashboard/.pylintrc @@ -54,24 +54,13 @@ confidence= # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" -disable=print-statement, - parameter-unpacking, - unpacking-in-except, - old-raise-syntax, - backtick, - long-suffix, - old-ne-operator, - old-octal-literal, - import-star-module-level, - non-ascii-bytes-literal, +disable=import-star-module-level, raw-checker-failed, bad-inline-option, locally-disabled, locally-enabled, - file-ignored, suppressed-message, useless-suppression, - deprecated-pragma, apply-builtin, basestring-builtin, buffer-builtin, @@ -96,7 +85,6 @@ disable=print-statement, next-method-called, metaclass-assignment, indexing-exception, - raising-string, reload-builtin, oct-method, hex-method, @@ -119,10 +107,6 @@ disable=print-statement, invalid-str-codec, sys-max-int, bad-python3-import, - deprecated-string-function, - deprecated-str-translate-call, - deprecated-itertools-function, - deprecated-types-field, next-method-defined, dict-items-not-iterating, dict-keys-not-iterating, @@ -132,7 +116,6 @@ disable=print-statement, no-self-use, too-few-public-methods, no-member, - fixme, too-many-arguments, too-many-locals diff --git a/src/pybind/mgr/dashboard/controllers/__init__.py b/src/pybind/mgr/dashboard/controllers/__init__.py index b79b5d0f038..f5995b8e63b 100644 --- a/src/pybind/mgr/dashboard/controllers/__init__.py +++ b/src/pybind/mgr/dashboard/controllers/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# pylint: disable=W0212 +# pylint: disable=protected-access from __future__ import absolute_import import collections @@ -526,7 +526,6 @@ class RESTController(BaseController): else: return inspect.getargspec(func).args[1:] # pylint: disable=deprecated-method - # pylint: disable=W1505 @staticmethod def _takes_json(func): def inner(*args, **kwargs): diff --git a/src/pybind/mgr/dashboard/controllers/cephfs.py b/src/pybind/mgr/dashboard/controllers/cephfs.py index 5ef80662624..59b57174326 100644 --- a/src/pybind/mgr/dashboard/controllers/cephfs.py +++ b/src/pybind/mgr/dashboard/controllers/cephfs.py @@ -284,8 +284,6 @@ class CephFSClients(object): self._module = module_inst self.fscid = fscid - # pylint: disable=unused-variable @ViewCache() def get(self): - # TODO handle nonzero returns, e.g. when rank isn't active return CephService.send_command('mds', 'session ls', srv_spec='{0}:0'.format(self.fscid)) diff --git a/src/pybind/mgr/dashboard/controllers/dashboard.py b/src/pybind/mgr/dashboard/controllers/dashboard.py index cf6ec6bf870..9a409b36dff 100644 --- a/src/pybind/mgr/dashboard/controllers/dashboard.py +++ b/src/pybind/mgr/dashboard/controllers/dashboard.py @@ -38,7 +38,6 @@ class Dashboard(BaseController): for l in lines: buf.appendleft(l) - # pylint: disable=R0914 @cherrypy.expose @cherrypy.tools.json_out() def health(self): diff --git a/src/pybind/mgr/dashboard/controllers/rbd.py b/src/pybind/mgr/dashboard/controllers/rbd.py index e177bd1ddcf..ffce261877c 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd.py +++ b/src/pybind/mgr/dashboard/controllers/rbd.py @@ -255,7 +255,6 @@ class Rbd(RESTController): return result def list(self, pool_name=None): - # pylint: disable=unbalanced-tuple-unpacking return self._rbd_list(pool_name) def get(self, pool_name, image_name): diff --git a/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py b/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py index 8fb1ec56577..b90401e1885 100644 --- a/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py +++ b/src/pybind/mgr/dashboard/controllers/rbd_mirroring.py @@ -56,7 +56,7 @@ def get_daemons_and_pools(): # pylint: disable=R0915 'health_color': 'info', 'health': 'Unknown' } - for _, pool_data in daemon['status'].items(): # TODO: simplify + for _, pool_data in daemon['status'].items(): if (health['health'] != 'error' and [k for k, v in pool_data.get('callouts', {}).items() if v['level'] == 'error']): diff --git a/src/pybind/mgr/dashboard/tests/helper.py b/src/pybind/mgr/dashboard/tests/helper.py index 6eb58a4e835..69a9ab756ed 100644 --- a/src/pybind/mgr/dashboard/tests/helper.py +++ b/src/pybind/mgr/dashboard/tests/helper.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# pylint: disable=W0212,too-many-arguments +# pylint: disable=too-many-arguments from __future__ import absolute_import import json @@ -70,6 +70,7 @@ class ControllerTestCase(helper.CPWebCase): task_name = res['name'] task_metadata = res['metadata'] + # pylint: disable=protected-access class Waiter(threading.Thread): def __init__(self, task_name, task_metadata, tc): super(Waiter, self).__init__() diff --git a/src/pybind/mgr/dashboard/tests/test_tools.py b/src/pybind/mgr/dashboard/tests/test_tools.py index e89f4697fc4..e9a58d162cc 100644 --- a/src/pybind/mgr/dashboard/tests/test_tools.py +++ b/src/pybind/mgr/dashboard/tests/test_tools.py @@ -11,7 +11,6 @@ from ..controllers import RESTController, ApiController from ..tools import is_valid_ipv6_address, dict_contains_path -# pylint: disable=W0613 @ApiController('foo') class FooResource(RESTController): elems = [] @@ -49,7 +48,7 @@ class FooArgs(RESTController): return {'code': code, 'name': name, 'opt1': opt1, 'opt2': opt2} -# pylint: disable=C0102 +# pylint: disable=blacklisted-name class Root(object): foo = FooResource() fooargs = FooArgs() diff --git a/src/pybind/mgr/dashboard/tools.py b/src/pybind/mgr/dashboard/tools.py index 05b42d8469a..f3d5b528f55 100644 --- a/src/pybind/mgr/dashboard/tools.py +++ b/src/pybind/mgr/dashboard/tools.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -# pylint: disable=W0212 from __future__ import absolute_import import collections @@ -395,7 +394,7 @@ class NotificationQueue(threading.Thread): logger.debug("notification queue finished") -# pylint: disable=too-many-arguments +# pylint: disable=too-many-arguments, protected-access class TaskManager(object): FINISHED_TASK_SIZE = 10 FINISHED_TASK_TTL = 60.0 @@ -504,6 +503,7 @@ class TaskManager(object): } for t in fn_t] +# pylint: disable=protected-access class TaskExecutor(object): def __init__(self): self.task = None @@ -528,6 +528,7 @@ class TaskExecutor(object): self.task._complete(ret_value, exception) +# pylint: disable=protected-access class ThreadedExecutor(TaskExecutor): def __init__(self): super(ThreadedExecutor, self).__init__() -- 2.39.5