Module: check_mk
Branch: master
Commit: f4aa739d4df96d021db6749179b3f5c1560fd919
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f4aa739d4df96d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 10 11:08:26 2010 +0100
Added reindent validation check
---
validate_checks => doc/helpers/validate_checks | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/validate_checks b/doc/helpers/validate_checks
similarity index 93%
rename from validate_checks
rename to doc/helpers/validate_checks
index 7e1f4dd..1108402 100755
--- a/validate_checks
+++ b/doc/helpers/validate_checks
@@ -9,6 +9,7 @@
# - Check Namen in der Variable?
import os, sys
+import reindent
on_tty = sys.stdout.isatty()
@@ -57,6 +58,7 @@ else:
__name__ = 'asd'
+os.chdir('../../')
defaults_path = 'defaults'
#autochecks = []
execfile('check_mk')
@@ -84,13 +86,22 @@ SCORE_START = 10
C_OK = 1
C_FAILED = 2
C_INVALID = 3
-TESTS = { 'manpage': C_OK, 'snmp_scan': C_OK, 'pnp_tmpl': C_OK,
'pnp_rra': C_OK, 'snmp_scan': C_OK }
+TESTS = { 'manpage': C_OK, 'snmp_scan': C_OK, 'pnp_tmpl': C_OK,
'pnp_rra': C_OK, 'snmp_scan': C_OK, 'reindent': C_OK }
WEIGHT = { 'manpage': 2 }
#
# Check definitions
#
+def is_valid_reindent(check):
+ return True
+
+def verify_reindent(check):
+ f = open('checks/%s' % check.split('.')[0])
+ r = reindent.Reindenter(f)
+ f.close()
+ return not r.run()
+
def is_valid_manpage(check):
return True