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

branch
eric7
changeset 11147
dee6e106b4d3
parent 11142
2f0fb22c1d63
child 11150
73d80859079c
diff -r 59e04f7003e9 -r dee6e106b4d3 src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Sun Feb 23 12:42:47 2025 +0100
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Mon Feb 24 15:11:18 2025 +0100
@@ -69,7 +69,7 @@
         self.__repeat = options.repeat
         self.errors = []
 
-    def error_args(self, line_number, offset, errorCode, check, *args):
+    def error_args(self, line_number, offset, text, _check, *args):
         """
         Public method to collect the error messages.
 
@@ -77,16 +77,26 @@
         @type int
         @param offset position within line of the issue
         @type int
-        @param errorCode error message code
+        @param text issue message code or issue text
         @type str
-        @param check reference to the checker function
+        @param _check reference to the checker function
         @type function
         @param args arguments for the message
         @type list
         @return error code
         @rtype str
         """
-        errorCode = super().error_args(line_number, offset, errorCode, check, *args)
+        code = text.split(None, 1)[0]
+        errorCode = code[0] + "-" + code[1:]
+        if self._ignore_code(errorCode):
+            return None
+        if errorCode in self.counters:
+            self.counters[errorCode] += 1
+        else:
+            self.counters[errorCode] = 1
+        # Don't care about expected errors or warnings
+        if errorCode in self.expected:
+            return None
         if errorCode and (self.counters[errorCode] == 1 or self.__repeat):
             self.errors.append(
                 {
@@ -347,11 +357,11 @@
                 "file": filename,
                 "line": offset[0],
                 "offset": offset[1],
-                "code": "E901",
+                "code": "E-901",
                 "args": [exc_type.__name__, exc.args[0]],
             },
             {
-                "E901": 1,
+                "E-901": 1,
             },
             None,
         )

eric ide

mercurial