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

branch
eric7
changeset 10041
67c8efa6d098
parent 9786
f94b530722af
child 10046
35b27af462ef
--- a/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Fri May 19 15:09:24 2023 +0200
+++ b/src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Fri May 19 16:01:22 2023 +0200
@@ -109,16 +109,22 @@
                 endPos = line.rfind(endComment)
                 if endPos >= 0:
                     comment = comment[:endPos]
-            flags = [
-                f.strip()
-                for f in comment.split()
-                if (f.startswith("__") and f.endswith("__"))
-            ]
-            flags += [
-                f.strip().lower()
-                for f in comment.split()
-                if f in ("noqa", "NOQA", "nosec", "NOSEC", "secok", "SECOK")
-            ]
+            if comment.startswith(("noqa:", "NOQA:")):
+                flags = [
+                    "noqa:{0}".format(f.strip())
+                    for f in comment[len("noqa:"):].split(",")
+                ]
+            else:
+                flags = [
+                    f.strip()
+                    for f in comment.split()
+                    if (f.startswith("__") and f.endswith("__"))
+                ]
+                flags += [
+                    f.strip().lower()
+                    for f in comment.split()
+                    if f in ("noqa", "NOQA", "nosec", "NOSEC", "secok", "SECOK")
+                ]
     return flags
 
 
@@ -148,6 +154,10 @@
                 ignoredCode = flag[2:-2].rsplit("_", 1)[-1]
                 if code.startswith(ignoredCode):
                     return True
+            elif flag.startswith("noqa:"):
+                ignoredCode = flag[len("noqa:"):].strip()
+                if code.startswith(ignoredCode):
+                    return True
 
     return False
 

eric ide

mercurial