eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py

changeset 7609
d5aff4fd0ef8
parent 7533
88261c96484b
child 7611
d546c4e72f52
diff -r a3a4760b59ec -r d5aff4fd0ef8 eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py	Sun May 31 17:23:49 2020 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCodeSelectionDialog.py	Thu Jun 04 17:57:20 2020 +0200
@@ -20,20 +20,27 @@
     """
     Class implementing a dialog to select code style message codes.
     """
-    def __init__(self, codes, showFixCodes, parent=None):
+    def __init__(self, codes, categories, showFixCodes, parent=None):
         """
         Constructor
         
-        @param codes comma separated list of selected codes (string)
+        @param codes comma separated list of selected codes
+        @type str
+        @param categories list of message categories to omit
+        @type list of str
         @param showFixCodes flag indicating to show a list of fixable
-            issues (boolean)
-        @param parent reference to the parent widget (QWidget)
+            issues
+        @type bool
+        @param parent reference to the parent widget
+        @type QWidget
         """
         super(CodeStyleCodeSelectionDialog, self).__init__(parent)
         self.setupUi(self)
         
         self.codeTable.headerItem().setText(self.codeTable.columnCount(), "")
         codeList = [code.strip() for code in codes.split(",") if code.strip()]
+        if categories:
+            codeList = [code for code in codeList if not code[0] in categories]
         
         from .translations import _messages, _messages_sample_args
         
@@ -42,7 +49,11 @@
             selectableCodes = FixableCodeStyleIssues
         else:
             selectableCodes = [x for x in list(_messages.keys())
-                               if not x.startswith('F')]
+                               if not x.startswith('FIX')]
+            if categories:
+                # filter by category
+                selectableCodes = [x for x in selectableCodes
+                                   if not x[0] in categories]
         for code in sorted(selectableCodes):
             if code in _messages_sample_args:
                 message = _messages[code].format(*_messages_sample_args[code])
@@ -55,7 +66,7 @@
                 itm.setIcon(0, UI.PixmapCache.getIcon("warning"))
             elif code.startswith("E"):
                 itm.setIcon(0, UI.PixmapCache.getIcon("syntaxError"))
-            elif code.startswith("N"):
+            elif code.startswith(("A", "N")):
                 itm.setIcon(0, UI.PixmapCache.getIcon("namingError"))
             elif code.startswith("D"):
                 itm.setIcon(0, UI.PixmapCache.getIcon("docstringError"))
@@ -78,7 +89,8 @@
         """
         Public method to get a comma separated list of codes selected.
         
-        @return comma separated list of selected codes (string)
+        @return comma separated list of selected codes
+        @rtype str
         """
         selectedCodes = []
         

eric ide

mercurial