src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py

branch
eric7
changeset 10052
041d0785dd42
parent 10046
35b27af462ef
child 10059
9e3452188615
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Mon May 22 19:46:19 2023 +0200
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Mon May 22 19:53:41 2023 +0200
@@ -25,6 +25,7 @@
 from PathLib.PathlibChecker import PathlibChecker
 from Security.SecurityChecker import SecurityChecker
 from Simplify.SimplifyChecker import SimplifyChecker
+from Unused.UnusedChecker import UnusedChecker
 
 # register the name checker
 pycodestyle.register_check(NamingStyleChecker, NamingStyleChecker.Codes)
@@ -192,10 +193,10 @@
         excludeMessages, includeMessages, repeatMessages, fixCodes,
         noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines,
         hangClosing, docType, codeComplexityArgs, miscellaneousArgs,
-        annotationArgs, securityArgs, importsArgs, nameOrderArgs, errors, eol, encoding,
-        backup)
+        annotationArgs, securityArgs, importsArgs, nameOrderArgs, unusedArgs, errors,
+        eol, encoding, backup)
     @type list of (str, str, bool, str, str, bool, int, list of (int, int),
-        bool, str, dict, dict, dict, dict, dict, list of str, str, str, bool)
+        bool, str, dict, dict, dict, dict, dict, dict, list of str, str, str, bool)
     @return tuple of statistics (dict) and list of results (tuple for each
         found violation of style (lineno, position, text, ignored, fixed,
         autofixing, fixedMsg))
@@ -356,10 +357,10 @@
         excludeMessages, includeMessages, repeatMessages, fixCodes,
         noFixCodes, fixIssues, maxLineLength, maxDocLineLength, blankLines,
         hangClosing, docType, codeComplexityArgs, miscellaneousArgs,
-        annotationArgs, securityArgs, importsArgs, nameOrderArgs, errors, eol, encoding,
-        backup)
+        annotationArgs, securityArgs, importsArgs, nameOrderArgs, unusedArgs, errors,
+        eol, encoding, backup)
     @type list of (str, str, bool, str, str, bool, int, list of (int, int),
-        bool, str, dict, dict, dict, dict, dict, list of str, str, str, bool)
+        bool, str, dict, dict, dict, dict, dict, dict, list of str, str, str, bool)
     @return tuple of statistics data and list of result dictionaries with
         keys:
         <ul>
@@ -394,6 +395,7 @@
         securityArgs,
         importsArgs,
         nameOrderArgs,
+        unusedArgs,
         errors,
         eol,
         encoding,
@@ -559,6 +561,22 @@
             stats.update(nameOrderChecker.counters)
             errors += nameOrderChecker.errors
 
+            # check unused arguments and variables
+            # TODO: not yet implemented
+            unusedChecker = UnusedChecker(
+                source,
+                filename,
+                tree,
+                select,
+                ignore,
+                [],
+                repeatMessages,
+                unusedArgs,
+            )
+            unusedChecker.run()
+            stats.update(unusedChecker.counters)
+            errors += unusedChecker.errors
+
         elif syntaxError:
             errors = [syntaxError]
             stats.update(syntaxStats)

eric ide

mercurial