Module: check_mk
Branch: master
Commit: 8a7c98e42368a855408cf987ab7089f3f2869446
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8a7c98e42368a8…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Jul 26 15:26:47 2018 +0200
Fixed and enabled ungrouped-imports warning.
Change-Id: I856a49659fa8f7caadcf81c6c97e13f1c534a426
---
cmk/ec/main.py | 3 ++-
cmk/gui/bi.py | 1 -
cmk/gui/valuespec.py | 3 ++-
cmk/store.py | 1 -
cmk_base/check_api.py | 7 +++----
cmk_base/core.py | 3 ++-
cmk_base/crash_reporting.py | 2 +-
cmk_base/data_sources/__init__.py | 2 +-
cmk_base/modes/check_mk.py | 2 +-
cmk_base/snmp.py | 2 +-
tests/pylint/pylintrc | 1 -
tests/pylint/test_pylint.py | 2 ++
12 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/cmk/ec/main.py b/cmk/ec/main.py
index aa09b6d..a79f877 100644
--- a/cmk/ec/main.py
+++ b/cmk/ec/main.py
@@ -59,9 +59,10 @@ import cmk.log
import cmk.paths
import cmk.profile
import cmk.render
-import livestatus
import cmk.regex
+import livestatus
+
class SyslogPriority(object):
NAMES = {
diff --git a/cmk/gui/bi.py b/cmk/gui/bi.py
index a749d52..f143022 100644
--- a/cmk/gui/bi.py
+++ b/cmk/gui/bi.py
@@ -33,7 +33,6 @@ import fcntl
import md5
import copy
import multiprocessing
-import pprint
from contextlib import contextmanager
import traceback
diff --git a/cmk/gui/valuespec.py b/cmk/gui/valuespec.py
index 8ea125e..5e0ba3d 100644
--- a/cmk/gui/valuespec.py
+++ b/cmk/gui/valuespec.py
@@ -52,7 +52,6 @@ import json
import cmk.paths
import cmk.defines as defines
-import livestatus
import cmk.gui.pages
import cmk.gui.forms as forms
@@ -62,6 +61,8 @@ from cmk.gui.globals import html
from cmk.gui.htmllib import HTML
from cmk.gui.exceptions import MKUserError, MKGeneralException
+import livestatus
+
def type_name(v):
try:
return type(v).__name__
diff --git a/cmk/store.py b/cmk/store.py
index 7620c83..88f1e3a 100644
--- a/cmk/store.py
+++ b/cmk/store.py
@@ -34,7 +34,6 @@ import os
import pprint
import tempfile
import time
-import pprint
from .exceptions import MKGeneralException
diff --git a/cmk_base/check_api.py b/cmk_base/check_api.py
index 3164fcb..88fe3db 100644
--- a/cmk_base/check_api.py
+++ b/cmk_base/check_api.py
@@ -89,15 +89,17 @@ Global variables:
# concatenates lots of files, including this one.
import cmk.debug as _debug
+import cmk.defines as _defines
import cmk.paths as _paths
from cmk.exceptions import MKGeneralException
+from cmk.regex import regex
+import cmk.render as render
# These imports are not meant for use in the API. So we prefix the names
# with an underscore. These names will be skipped when loading into the
# check context.
import cmk_base.utils as _utils
import cmk_base.config as _config
-import cmk.defines as _defines
import cmk_base.snmp_utils as _snmp_utils
import cmk_base.item_state as _item_state
import cmk_base.prediction as _prediction
@@ -132,9 +134,6 @@ import time
# 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
-
# Names of texts usually output by checks
core_state_names = _defines.short_service_state_names()
diff --git a/cmk_base/core.py b/cmk_base/core.py
index aa63a36..ca99d21 100644
--- a/cmk_base/core.py
+++ b/cmk_base/core.py
@@ -35,7 +35,6 @@ import sys
import cmk.paths
import cmk.debug
import cmk.tty as tty
-import livestatus
from cmk.exceptions import MKGeneralException
import cmk_base.console as console
@@ -46,6 +45,8 @@ from cmk_base.exceptions import MKTimeout
from cmk_base import config_cache
import cmk_base.cleanup
+import livestatus
+
_restart_lock_fd = None
#.
diff --git a/cmk_base/crash_reporting.py b/cmk_base/crash_reporting.py
index e1964b4..d2848ab 100644
--- a/cmk_base/crash_reporting.py
+++ b/cmk_base/crash_reporting.py
@@ -33,9 +33,9 @@ import cStringIO as StringIO
import cmk.debug
import cmk.paths
-import cmk_base.config as config
import cmk.crash_reporting as crash_reporting
+import cmk_base.config as config
import cmk_base.utils
import cmk_base.check_utils
diff --git a/cmk_base/data_sources/__init__.py b/cmk_base/data_sources/__init__.py
index d6b67c5..37f39e5 100644
--- a/cmk_base/data_sources/__init__.py
+++ b/cmk_base/data_sources/__init__.py
@@ -45,9 +45,9 @@ import time
import cmk.paths
import cmk.debug
from cmk.exceptions import MKGeneralException
+import cmk.store as store
import cmk_base
-import cmk.store as store
import cmk_base.config as config
import cmk_base.console as console
import cmk_base.item_state as item_state
diff --git a/cmk_base/modes/check_mk.py b/cmk_base/modes/check_mk.py
index 4bfd35d..7ee1ecd 100644
--- a/cmk_base/modes/check_mk.py
+++ b/cmk_base/modes/check_mk.py
@@ -290,9 +290,9 @@ modes.register(Mode(
# | |
# '----------------------------------------------------------------------'
-import cmk.man_pages as man_pages
def mode_list_checks():
+ import cmk.man_pages as man_pages
all_check_manuals = man_pages.all_man_pages()
checks_sorted = config.check_info.items() + \
diff --git a/cmk_base/snmp.py b/cmk_base/snmp.py
index bcf09c4..ec29518 100644
--- a/cmk_base/snmp.py
+++ b/cmk_base/snmp.py
@@ -30,12 +30,12 @@ import subprocess
import cmk.debug
import cmk.tty as tty
from cmk.exceptions import MKGeneralException, MKBailOut
+import cmk.store as store
import cmk_base.utils
import cmk_base.config as config
import cmk_base.console as console
import cmk_base.classic_snmp as classic_snmp
-import cmk.store as store
import cmk_base.ip_lookup as ip_lookup
import cmk_base.agent_simulator
from cmk_base.exceptions import MKSNMPError
diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc
index 577a98c..0429ab7 100644
--- a/tests/pylint/pylintrc
+++ b/tests/pylint/pylintrc
@@ -22,7 +22,6 @@ disable=
protected-access,
reimported,
relative-import,
- ungrouped-imports,
#---------------------------------------------------------------------------
# We should really enable this, there could be some real exceptions waiting
# to be thrown. But some work is needed first to sprinkle abc annotations
diff --git a/tests/pylint/test_pylint.py b/tests/pylint/test_pylint.py
index d96e893..cd76122 100755
--- a/tests/pylint/test_pylint.py
+++ b/tests/pylint/test_pylint.py
@@ -122,6 +122,8 @@ def inv_tree(path, default_value=None):
# add the modules
pylint_cmk.add_file(f, repo_path() + "/cmk_base/check_api.py")
+ # This pylint warning is incompatible with our "concatenation
technology".
+ f.write("# pylint: disable=ungrouped-imports\n")
pylint_cmk.add_file(f, repo_path() + "/cmk_base/inventory_plugins.py")
# Now add the checks