Module: check_mk
Branch: master
Commit: 96669cde6be8d87143965e7aa82373f51080524d
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=96669cde6be8d8…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Jul 23 15:41:12 2018 +0200
Fixed a few unused-import warnings and classified the warning.
Change-Id: I4644104434b67631fc215dc1181a1f09239ff4c7
---
cmk_base/check_api.py | 4 ++--
tests/pylint/pylintrc | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/cmk_base/check_api.py b/cmk_base/check_api.py
index 381849c..3164fcb 100644
--- a/cmk_base/check_api.py
+++ b/cmk_base/check_api.py
@@ -96,7 +96,6 @@ from cmk.exceptions import MKGeneralException
# with an underscore. These names will be skipped when loading into the
# check context.
import cmk_base.utils as _utils
-import cmk_base.console as _console
import cmk_base.config as _config
import cmk.defines as _defines
import cmk_base.snmp_utils as _snmp_utils
@@ -130,7 +129,8 @@ import socket
import sys
import os
import time
-import pprint
+# NOTE: We do not use pprint in this module, but it is part of the check API.
+import pprint # pylint: disable=unused-import
from cmk.regex import regex
import cmk.render as render
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index 3fb6b4c..a3867ed 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -36,7 +36,6 @@ disable=
unsubscriptable-object,
unsupported-membership-test,
unused-argument,
- unused-import,
unused-wildcard-import,
wildcard-import,
wrong-import-order,
@@ -75,6 +74,10 @@ disable=
# gigantic functions.
too-many-branches,
#---------------------------------------------------------------------------
+ # We have tons of unused imports, it is just a matter of removing them and
+ # leave those which have a "magic" purpose.
+ unused-import,
+ #---------------------------------------------------------------------------
# Enabling these warnings would be nice, they are mostly a sign of sloppy
# programming practice. In some cases, they can even hide bugs.
bare-except,
Module: check_mk
Branch: master
Commit: cb0a47620732be055f1a00dc28144c6fd1c07d9f
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cb0a47620732be…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Mon Jul 23 14:58:24 2018 +0200
Classified a few more warnings.
Change-Id: I4fea02635adb02ad0c5708088bf640226fe2c957
---
tests/pylint/pylintrc | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index 3b71e37..3fb6b4c 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -18,14 +18,8 @@ disable=
consider-using-enumerate,
consider-using-ternary,
duplicate-code,
- eval-used,
- exec-used,
- fixme,
- global-statement,
- global-variable-undefined,
inconsistent-return-statements,
len-as-condition,
- line-too-long,
logging-not-lazy,
missing-docstring,
multiple-imports,
@@ -39,7 +33,6 @@ disable=
reimported,
relative-import,
ungrouped-imports,
- unidiomatic-typecheck,
unsubscriptable-object,
unsupported-membership-test,
unused-argument,
@@ -69,6 +62,15 @@ disable=
# duplication (introduce new classes, combine methods, etc.)
attribute-defined-outside-init,
#---------------------------------------------------------------------------
+ # Enabling this would be very desirable, using type() instead of
+ # isinstance() is a very bad idea most of the time, as it totally ignores
+ # class hierarchies, breaking things in subtle ways.
+ unidiomatic-typecheck,
+ #---------------------------------------------------------------------------
+ # This should really be fixed: Global variables are already a bad idea, but
+ # depending on an implicit protocol to create them is an even worse one.
+ global-variable-undefined,
+ #---------------------------------------------------------------------------
# We should enable this, at the moment it just means splitting up two
# gigantic functions.
too-many-branches,
@@ -87,6 +89,13 @@ disable=
# a few violations, so we postpone fixing this.
singleton-comparison,
#---------------------------------------------------------------------------
+ # Alas, these maintenance/security nightmares are still part of our base
+ # "technology"... :-/ Nevertheless, reducing their usage is a very worthy
+ # goal.
+ eval-used,
+ exec-used,
+ global-statement,
+ #---------------------------------------------------------------------------
# Enabling these would be nice, but given the current state of affairs
# (gigantic modules with deeply nested humungous functions/methods), this
# will be a non-trivial amount of work.
@@ -101,10 +110,15 @@ disable=
too-many-return-statements,
too-many-statements,
#---------------------------------------------------------------------------
+ # Our code is still full of FIXMEs/XXXs/TODOs, perhaps fixing or removing
+ # them might be a good idea some day...
+ fixme,
+ #---------------------------------------------------------------------------
# The warnigns below will probably fixed by YAPF.
bad-continuation,
bad-indentation,
bad-whitespace,
+ line-too-long,
#---------------------------------------------------------------------------
# Enabling the two spelling-related checks increases pylints runtime from
# 11 min to 40 min, so we better keep those disabled for normal runs.