Code Style Checker, Syntax Checker: added support for '# noqa' and '# NOQA' comments to suppress warnings

Fri, 13 Apr 2018 18:50:57 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 13 Apr 2018 18:50:57 +0200
changeset 6235
0e6a395ecfe8
parent 6234
fb1f9e681848
child 6236
de1de28d0930
child 6246
fe07a9f16f23

Code Style Checker, Syntax Checker: added support for '# noqa' and '# NOQA' comments to suppress warnings

Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py file | annotate | diff | comparison | revisions
Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py file | annotate | diff | comparison | revisions
changelog file | annotate | diff | comparison | revisions
--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Thu Apr 12 19:12:36 2018 +0200
+++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py	Fri Apr 13 18:50:57 2018 +0200
@@ -103,6 +103,8 @@
                     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")]
     return flags
 
 
@@ -119,7 +121,8 @@
     """
     if lineFlags:
         
-        if "__IGNORE_WARNING__" in lineFlags:
+        if "__IGNORE_WARNING__" in lineFlags or \
+           "noqa" in lineFlags:
             # ignore all warning codes
             return True
         
--- a/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py	Thu Apr 12 19:12:36 2018 +0200
+++ b/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py	Fri Apr 13 18:50:57 2018 +0200
@@ -102,6 +102,8 @@
                     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")]
     return flags
 
 
@@ -331,7 +333,8 @@
                                               flagsLine=True)
             except IndexError:
                 pass
-            if "__IGNORE_WARNING__" not in lineFlags:
+            if "__IGNORE_WARNING__" not in lineFlags and \
+               "noqa" not in lineFlags:
                 results.append((_fn, lineno, col, "", message, msg_args))
     except SyntaxError as err:
         if err.text.strip():
--- a/changelog	Thu Apr 12 19:12:36 2018 +0200
+++ b/changelog	Fri Apr 13 18:50:57 2018 +0200
@@ -2,6 +2,10 @@
 ----------
 Version 18.05:
 - bug fixes
+- Code Style Checker
+  -- added support for '# noqa' and '# NOQA' comments to suppress warnings
+- Syntax Checker
+  -- added support for '# noqa' and '# NOQA' comments to suppress warnings
 - Translator
   -- updated the translator URL for DeepL
 - Web Browser (NG)

eric ide

mercurial