]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Clean up Pylint warnings
authorSebastian Wagner <sebastian.wagner@suse.com>
Fri, 27 Apr 2018 12:54:44 +0000 (14:54 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Fri, 27 Apr 2018 12:54:44 +0000 (14:54 +0200)
* 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 <sebastian.wagner@suse.com>
src/pybind/mgr/dashboard/.pylintrc
src/pybind/mgr/dashboard/controllers/__init__.py
src/pybind/mgr/dashboard/controllers/cephfs.py
src/pybind/mgr/dashboard/controllers/dashboard.py
src/pybind/mgr/dashboard/controllers/rbd.py
src/pybind/mgr/dashboard/controllers/rbd_mirroring.py
src/pybind/mgr/dashboard/tests/helper.py
src/pybind/mgr/dashboard/tests/test_tools.py
src/pybind/mgr/dashboard/tools.py

index 96f88facc3fd704f3bc8f615c490d25ddef3b4a8..be857f8482f0a3b5c7eb5c46c9e5244449b7c1a1 100644 (file)
@@ -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
 
index b79b5d0f03869b875a0a954c0e1f8eaf4991aa7e..f5995b8e63b1b13d0158af57c6e8fea58c6ed51d 100644 (file)
@@ -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):
index 5ef8066262460b9bf3322c456004402874b80287..59b57174326beb8c3e45ecf53ae9d8f73678f04e 100644 (file)
@@ -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))
index cf6ec6bf87072efc0404cc1feac23dcb8bf6935f..9a409b36dff7fa4d44030eee09e60aa7f66a4cc3 100644 (file)
@@ -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):
index e177bd1ddcf3439f3e1f40a2c0bad8e19d97b0a1..ffce261877cafe525924f0090f626cbf4a594191 100644 (file)
@@ -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):
index 8fb1ec56577d702372b99110748630ea6d464bfb..b90401e1885493a82d277e33d25d0c6e1ee45782 100644 (file)
@@ -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']):
index 6eb58a4e835b61ce98873c946d828787c00b601d..69a9ab756edf7b11396ddb96baf64f39e598c3d5 100644 (file)
@@ -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__()
index e89f4697fc47671e3d3c06aac88d33ee54042e8b..e9a58d162cc0e7cd0cdcb1c157af937842ef548a 100644 (file)
@@ -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()
index 05b42d8469ac4d3a0d6fea5840310d9ee8f7b25e..f3d5b528f557081ec24afa8ed86d4268bb2c2798 100644 (file)
@@ -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__()