Module: check_mk
Branch: master
Commit: 24fb5bc416044542eb0584f1846db4578e4c3178
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=24fb5bc4160445…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 13 15:34:19 2018 +0200
pylint_misc: Invoke pylint once for all files to be checked
Change-Id: Id1e6a3a98291752e9a88166661459464a63b71f6
---
tests/pylint/test_pylint_misc.py | 73 +++++++++++++++++++---------------------
1 file changed, 34 insertions(+), 39 deletions(-)
diff --git a/tests/pylint/test_pylint_misc.py b/tests/pylint/test_pylint_misc.py
index 85274dc..ee6ac17 100755
--- a/tests/pylint/test_pylint_misc.py
+++ b/tests/pylint/test_pylint_misc.py
@@ -8,47 +8,42 @@ from testlib import cmk_path, cmc_path, cme_path
import testlib.pylint_cmk as pylint_cmk
def test_pylint_misc():
+ modules_or_packages = [
+ "cmk_base",
+ "cmk_base/modes",
+ "cmk_base/automations",
+ "cmk_base/default_config",
+ "cmk_base/data_sources",
+
+ "enterprise/cmk/cee",
+ "enterprise/cmk/cee/liveproxy",
+ "enterprise/cmk_base/cee",
+ "enterprise/cmk_base/modes/cee.py",
+ "enterprise/cmk_base/automations/cee.py",
+ "enterprise/cmk_base/default_config/cee.py",
+
+ "managed/cmk_base/default_config/cme.py",
+
+ "cmk",
+ "cmk/ec",
+ ]
+
+ # We use our own search logic to find scripts without python extension
search_paths = [
- cmk_path() + "/omd/packages/omd",
-
- cmk_path() + "/cmk_base",
- cmk_path() + "/cmk_base/modes",
- cmk_path() + "/cmk_base/automations",
- cmk_path() + "/cmk_base/default_config",
- cmk_path() + "/cmk_base/data_sources",
-
- cmc_path() + "/cmk",
- cmc_path() + "/cmk/gui",
- cme_path() + "/cmk/gui/default_config",
- cmc_path() + "/cmk/cee/liveproxy",
- cmc_path() + "/cmk_base",
- cmc_path() + "/cmk_base/cee",
- cmc_path() + "/cmk_base/modes",
- cmc_path() + "/cmk_base/automations",
- cmc_path() + "/cmk_base/default_config",
-
- cme_path() + "/cmk/gui",
- cme_path() + "/cmk/gui/default_config",
- cme_path() + "/cmk_base/default_config",
-
- cmk_path() + "/cmk",
- cmk_path() + "/cmk/ec",
- cmk_path() + "/cmk/gui",
- cmk_path() + "/cmk/gui/default_config",
- cmk_path() + "/bin",
- cmk_path() + "/notifications",
- cmk_path() + "/agents/plugins",
- cmk_path() + "/agents/special",
- cmk_path() + "/active_checks",
- cmc_path() + "/agents/plugins",
- cmc_path() + "/bin",
- cmc_path() + "/misc",
+ "omd/packages/omd",
+ "bin",
+ "notifications",
+ "agents/plugins",
+ "agents/special",
+ "active_checks",
+ "enterprise/agents/plugins",
+ "enterprise/bin",
+ "enterprise/misc",
]
- checked, worst = 0, 0
for path in search_paths:
- worst = max(worst, pylint_cmk.run_pylint(path))
- checked += 1
+ for fname in pylint_cmk.get_pylint_files(path, "*"):
+ modules_or_packages.append(path + "/" + fname)
- assert checked > 0, "Did not find a file to check!"
- assert worst == 0, "At least one issue found"
+ exit_code = pylint_cmk.run_pylint(cmk_path(), modules_or_packages)
+ assert exit_code == 0, "PyLint found an error"