Module: check_mk
Branch: master
Commit: 2e88db761b207e24eb109fe39499302c7b01e4d3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2e88db761b207e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 22 19:44:37 2019 +0100
Final step to enable "redefined-outer-name" pylint checker
Needed some suppressions in different places, but it's ok for the
moment. And we have another enabled checker. yay!
Change-Id: I2bfba4d6d2b41bf678d83d835f8c26edb1c7ca88
---
.pylintrc | 5 -----
cmk/gui/watolib/__init__.py | 2 +-
cmk/gui/watolib/activate_changes.py | 6 +++---
cmk/gui/watolib/automations.py | 6 +++---
tests/pylint/test_pylint.py | 2 +-
5 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/.pylintrc b/.pylintrc
index 3546759..d7e9c1a 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -43,11 +43,6 @@ disable=
# uncover bugs. Fixing this is not rocket science, just some work.
inconsistent-return-statements,
#---------------------------------------------------------------------------
- # Enabling this would enhance readability quite a bit and it might even
- # uncover bugs. Fixing this is not rocket science, just some work: Roughly
- # 400 warnings in about 60 modules, but this can be fixed step by step.
- redefined-outer-name,
- #---------------------------------------------------------------------------
# Enabling this would be nice, but not crucial. Nevertheless, this would
# improve readability and involve some cleanups in our class hierarchy, so
# we should do this some day.
diff --git a/cmk/gui/watolib/__init__.py b/cmk/gui/watolib/__init__.py
index a105506..347b2ab 100644
--- a/cmk/gui/watolib/__init__.py
+++ b/cmk/gui/watolib/__init__.py
@@ -518,7 +518,7 @@ def _create_sample_config():
save_notification_rules(notification_rules)
try:
- import cmk.gui.cee.plugins.wato.sample_config
+ import cmk.gui.cee.plugins.wato.sample_config # pylint:
disable=redefined-outer-name
cmk.gui.cee.plugins.wato.sample_config.create_cee_sample_config()
except ImportError:
pass
diff --git a/cmk/gui/watolib/activate_changes.py b/cmk/gui/watolib/activate_changes.py
index 27bbf56..b67abb4 100644
--- a/cmk/gui/watolib/activate_changes.py
+++ b/cmk/gui/watolib/activate_changes.py
@@ -445,7 +445,7 @@ class ActivateChangesManager(ActivateChanges):
def _verify_valid_host_config(self):
# TODO: Cleanup this local import
- import cmk.gui.watolib.hosts_and_folders
+ import cmk.gui.watolib.hosts_and_folders # pylint: disable=redefined-outer-name
defective_hosts = cmk.gui.watolib.hosts_and_folders.validate_all_hosts([],
force_all=True)
if defective_hosts:
raise MKUserError(
@@ -542,7 +542,7 @@ class ActivateChangesManager(ActivateChanges):
# the activation)
def _pre_activate_changes(self):
# TODO: Cleanup this local import
- import cmk.gui.watolib.hosts_and_folders
+ import cmk.gui.watolib.hosts_and_folders # pylint: disable=redefined-outer-name
try:
if hooks.registered('pre-distribute-changes'):
hooks.call("pre-distribute-changes",
@@ -677,7 +677,7 @@ class ActivateChangesManager(ActivateChanges):
def create_site_globals_file(self, site_id, tmp_dir, sites=None):
# TODO: Cleanup this local import
- import cmk.gui.watolib.sites
+ import cmk.gui.watolib.sites # pylint: disable=redefined-outer-name
try:
os.makedirs(tmp_dir)
diff --git a/cmk/gui/watolib/automations.py b/cmk/gui/watolib/automations.py
index 3f4150e..c0d836a 100644
--- a/cmk/gui/watolib/automations.py
+++ b/cmk/gui/watolib/automations.py
@@ -178,7 +178,7 @@ def check_mk_remote_automation(site_id,
# If the site is not up-to-date, synchronize it first.
def sync_changes_before_remote_automation(site_id):
# TODO: Cleanup this local import
- import cmk.gui.watolib.activate_changes
+ import cmk.gui.watolib.activate_changes # pylint: disable=redefined-outer-name
manager = cmk.gui.watolib.activate_changes.ActivateChangesManager()
manager.load()
@@ -213,7 +213,7 @@ def sync_changes_before_remote_automation(site_id):
def call_hook_pre_activate_changes():
if hooks.registered('pre-activate-changes'):
# TODO: Cleanup this local import
- import cmk.gui.watolib.hosts_and_folders
+ import cmk.gui.watolib.hosts_and_folders # pylint: disable=redefined-outer-name
hooks.call("pre-activate-changes",
cmk.gui.watolib.hosts_and_folders.collect_all_hosts())
@@ -229,7 +229,7 @@ def call_hook_pre_activate_changes():
def call_hook_activate_changes():
if hooks.registered('activate-changes'):
# TODO: Cleanup this local import
- import cmk.gui.watolib.hosts_and_folders
+ import cmk.gui.watolib.hosts_and_folders # pylint: disable=redefined-outer-name
hooks.call("activate-changes",
cmk.gui.watolib.hosts_and_folders.collect_all_hosts())
diff --git a/tests/pylint/test_pylint.py b/tests/pylint/test_pylint.py
index e51993f..c686d5b 100755
--- a/tests/pylint/test_pylint.py
+++ b/tests/pylint/test_pylint.py
@@ -129,7 +129,7 @@ def inv_tree(path, default_value=None):
# add the modules
# These pylint warnings are incompatible with our "concatenation
technology".
f.write(
- "# pylint:
disable=reimported,ungrouped-imports,wrong-import-order,wrong-import-position\n"
+ "# pylint:
disable=reimported,ungrouped-imports,wrong-import-order,wrong-import-position,redefined-outer-name\n"
)
pylint_cmk.add_file(f, repo_path() + "/cmk_base/check_api.py")
pylint_cmk.add_file(f, repo_path() + "/cmk_base/inventory_plugins.py")