Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py

changeset 4423
14f3ca3dcef6
parent 4221
c9fdc07753a7
child 4444
4867c8189b62
diff -r 66be66ec3afc -r 14f3ca3dcef6 Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py
--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Wed Sep 02 18:46:11 2015 +0200
+++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Wed Sep 02 20:16:28 2015 +0200
@@ -12,6 +12,7 @@
 
 import pep8
 from NamingStyleChecker import NamingStyleChecker
+from McCabeChecker import McCabeChecker
 
 # register the name checker
 pep8.register_check(NamingStyleChecker, NamingStyleChecker.Codes)
@@ -187,9 +188,9 @@
         of style (tuple of lineno (int), position (int), text (str), ignored
             (bool), fixed (bool), autofixing (bool), fixedMsg (str)))
     """
-    excludeMessages, includeMessages, \
-        repeatMessages, fixCodes, noFixCodes, fixIssues, maxLineLength, \
-        hangClosing, docType, errors, eol, encoding, backup = args
+    (excludeMessages, includeMessages, repeatMessages, fixCodes, noFixCodes,
+     fixIssues, maxLineLength, hangClosing, docType, maxComplexity, errors,
+     eol, encoding, backup) = args
     
     stats = {}
 
@@ -232,6 +233,7 @@
         )
         report = styleGuide.check_files([filename])
         stats.update(report.counters)
+        errors = report.errors
 
         # check documentation style
         docStyleChecker = DocStyleChecker(
@@ -239,8 +241,14 @@
             maxLineLength=maxLineLength, docType=docType)
         docStyleChecker.run()
         stats.update(docStyleChecker.counters)
+        errors += docStyleChecker.errors
         
-        errors = report.errors + docStyleChecker.errors
+        # check code complexity iaw. McCabe
+        mccabeChecker = McCabeChecker(
+            source, filename, select, ignore, maxComplexity)
+        mccabeChecker.run()
+        stats.update(mccabeChecker.counters)
+        errors += mccabeChecker.errors
     
     deferredFixes = {}
     results = []

eric ide

mercurial