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

branch
eric7
changeset 11147
dee6e106b4d3
parent 11133
d650c9527b87
child 11148
15e30f0c76a8
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/LoggingVisitor.py	Sun Feb 23 12:42:47 2025 +0100
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Logging/LoggingVisitor.py	Mon Feb 24 15:11:18 2025 +0100
@@ -179,7 +179,7 @@
                     else:
                         lineno = node.lineno
                         colOffset = node.col_offset
-                    self.__error(lineno - 1, colOffset, "L109")
+                    self.__error(lineno - 1, colOffset, "L-109")
                 if not alias.asname:
                     self.__fromImports[alias.name] = node.module
 
@@ -198,7 +198,7 @@
             and node.value.id == self.__loggingName
             and node.attr == "WARN"
         ):
-            self.__error(node.lineno - 1, node.col_offset, "L109")
+            self.__error(node.lineno - 1, node.col_offset, "L-109")
 
         self.generic_visit(node)
 
@@ -223,7 +223,7 @@
                 and self.__fromImports.get("Logger") == "logging"
             )
         ) and not self.__atModuleLevel():
-            self.__error(node.lineno - 1, node.col_offset, "L101")
+            self.__error(node.lineno - 1, node.col_offset, "L-101")
 
         if (
             isinstance(node.func, ast.Attribute)
@@ -236,7 +236,7 @@
             and node.func.id in _LoggerMethods
             and self.__fromImports.get(node.func.id) == "logging"
         ):
-            self.__error(node.lineno - 1, node.col_offset, "L115")
+            self.__error(node.lineno - 1, node.col_offset, "L-115")
 
         if (
             self.__loggingName
@@ -263,7 +263,7 @@
                 and isinstance(node.args[0], ast.Name)
                 and node.args[0].id in self.GetLoggerNames
             ):
-                self.__error(node.args[0].lineno - 1, node.args[0].col_offset, "L102")
+                self.__error(node.args[0].lineno - 1, node.args[0].col_offset, "L-102")
 
         if (
             isinstance(node.func, ast.Attribute)
@@ -277,7 +277,7 @@
 
             # L108
             if node.func.attr == "warn":
-                self.__error(node.lineno - 1, node.col_offset, "L108")
+                self.__error(node.lineno - 1, node.col_offset, "L-108")
 
             # L103
             extraKeys = []
@@ -302,13 +302,13 @@
             for key, keyNode in extraKeys:
                 if key in _LogrecordAttributes:
                     self.__error(
-                        keyNode.lineno - 1, keyNode.col_offset, "L103", repr(key)
+                        keyNode.lineno - 1, keyNode.col_offset, "L-103", repr(key)
                     )
 
             if node.func.attr == "exception":
                 # L104
                 if not excHandler:
-                    self.__error(node.lineno - 1, node.col_offset, "L104")
+                    self.__error(node.lineno - 1, node.col_offset, "L-104")
 
                 if any((excInfo := kw).arg == "exc_info" for kw in node.keywords):
                     # L106
@@ -319,14 +319,14 @@
                         and isinstance(excInfo.value, ast.Name)
                         and excInfo.value.id == excHandler.name
                     ):
-                        self.__error(excInfo.lineno - 1, excInfo.col_offset, "L106")
+                        self.__error(excInfo.lineno - 1, excInfo.col_offset, "L-106")
 
                     # L107
                     elif (
                         isinstance(excInfo.value, ast.Constant)
                         and not excInfo.value.value
                     ):
-                        self.__error(excInfo.lineno - 1, excInfo.col_offset, "L107")
+                        self.__error(excInfo.lineno - 1, excInfo.col_offset, "L-107")
 
             # L105
             elif node.func.attr == "error" and excHandler is not None:
@@ -343,7 +343,7 @@
                     rewritable = True
 
                 if rewritable:
-                    self.__error(node.lineno - 1, node.col_offset, "L105")
+                    self.__error(node.lineno - 1, node.col_offset, "L-105")
 
             # L114
             elif (
@@ -352,7 +352,7 @@
                 and isinstance(excInfo.value, ast.Constant)
                 and excInfo.value.value
             ):
-                self.__error(excInfo.lineno - 1, excInfo.col_offset, "L114")
+                self.__error(excInfo.lineno - 1, excInfo.col_offset, "L-114")
 
             # L110
             if (
@@ -362,7 +362,7 @@
                 and excHandler is not None
                 and node.args[0].id == excHandler.name
             ):
-                self.__error(node.args[0].lineno - 1, node.args[0].col_offset, "L110")
+                self.__error(node.args[0].lineno - 1, node.args[0].col_offset, "L-110")
 
             msgArgKwarg = False
             if node.func.attr == "log" and len(node.args) >= 2:
@@ -378,7 +378,7 @@
 
             # L111
             if isinstance(msgArg, ast.JoinedStr):
-                self.__error(msgArg.lineno - 1, msgArg.col_offset, "L111a")
+                self.__error(msgArg.lineno - 1, msgArg.col_offset, "L-111a")
             elif (
                 isinstance(msgArg, ast.Call)
                 and isinstance(msgArg.func, ast.Attribute)
@@ -386,16 +386,16 @@
                 and isinstance(msgArg.func.value.value, str)
                 and msgArg.func.attr == "format"
             ):
-                self.__error(msgArg.lineno - 1, msgArg.col_offset, "L111b")
+                self.__error(msgArg.lineno - 1, msgArg.col_offset, "L-111b")
             elif (
                 isinstance(msgArg, ast.BinOp)
                 and isinstance(msgArg.op, ast.Mod)
                 and isinstance(msgArg.left, ast.Constant)
                 and isinstance(msgArg.left.value, str)
             ):
-                self.__error(msgArg.lineno - 1, msgArg.col_offset, "L111c")
+                self.__error(msgArg.lineno - 1, msgArg.col_offset, "L-111c")
             elif isinstance(msgArg, ast.BinOp) and self.__isAddChainWithNonStr(msgArg):
-                self.__error(msgArg.lineno - 1, msgArg.col_offset, "L111d")
+                self.__error(msgArg.lineno - 1, msgArg.col_offset, "L-111d")
 
             # L112
             if (
@@ -444,7 +444,7 @@
                 self.__error(
                     msgArg.lineno - 1,
                     msgArg.col_offset,
-                    "L113a",  # missing keys
+                    "L-113a",  # missing keys
                     ", ".join([repr(k) for k in missing]),
                 )
 
@@ -452,7 +452,7 @@
                 self.__error(
                     msgArg.lineno - 1,
                     msgArg.col_offset,
-                    "L113b",  # unreferenced keys
+                    "L-113b",  # unreferenced keys
                     ", ".join([repr(k) for k in missing]),
                 )
 
@@ -470,7 +470,7 @@
             self.__error(
                 msgArg.lineno - 1,
                 msgArg.col_offset,
-                "L112",
+                "L-112",
                 modposCount,
                 "'%'",  # noqa: M601
                 argCount,

eric ide

mercurial