Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py

changeset 6264
04a671fa4adb
parent 6188
5a6ae3be31e6
child 6265
56bd09c4c297
--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py	Sat Apr 21 17:11:05 2018 +0200
+++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py	Sat Apr 21 17:43:41 2018 +0200
@@ -315,6 +315,9 @@
             }
         if "MaxLineLength" not in self.__data:
             self.__data["MaxLineLength"] = pycodestyle.MAX_LINE_LENGTH
+        if "BlankLines" not in self.__data:
+            self.__data["BlankLines"] = (2, 1)
+            # top level, method
         if "HangClosing" not in self.__data:
             self.__data["HangClosing"] = False
         if "NoFixCodes" not in self.__data:
@@ -352,6 +355,8 @@
         self.fixIssuesCheckBox.setChecked(self.__data["FixIssues"])
         self.ignoredCheckBox.setChecked(self.__data["ShowIgnored"])
         self.lineLengthSpinBox.setValue(self.__data["MaxLineLength"])
+        self.blankBeforeTopLevelSpinBox.setValue(self.__data["BlankLines"][0])
+        self.blankBeforeMethodSpinBox.setValue(self.__data["BlankLines"][1])
         self.hangClosingCheckBox.setChecked(self.__data["HangClosing"])
         self.docTypeComboBox.setCurrentIndex(
             self.docTypeComboBox.findData(self.__data["DocstringType"]))
@@ -440,6 +445,10 @@
             self.showIgnored = self.ignoredCheckBox.isChecked() and \
                 repeatMessages
             maxLineLength = self.lineLengthSpinBox.value()
+            blankLines = (
+                self.blankBeforeTopLevelSpinBox.value(),
+                self.blankBeforeMethodSpinBox.value()
+            )
             hangClosing = self.hangClosingCheckBox.isChecked()
             docType = self.docTypeComboBox.itemData(
                 self.docTypeComboBox.currentIndex())
@@ -460,8 +469,8 @@
             
             self.__options = [excludeMessages, includeMessages, repeatMessages,
                               fixCodes, noFixCodes, fixIssues, maxLineLength,
-                              hangClosing, docType, codeComplexityArgs,
-                              miscellaneousArgs]
+                              blankLines, hangClosing, docType,
+                              codeComplexityArgs, miscellaneousArgs]
             
             # now go through all the files
             self.progress = 0
@@ -773,6 +782,10 @@
                 "FixIssues": self.fixIssuesCheckBox.isChecked(),
                 "ShowIgnored": self.ignoredCheckBox.isChecked(),
                 "MaxLineLength": self.lineLengthSpinBox.value(),
+                "BlankLines": (
+                    self.blankBeforeTopLevelSpinBox.value(),
+                    self.blankBeforeMethodSpinBox.value()
+                ),
                 "HangClosing": self.hangClosingCheckBox.isChecked(),
                 "DocstringType": self.docTypeComboBox.itemData(
                     self.docTypeComboBox.currentIndex()),
@@ -951,6 +964,12 @@
             Preferences.Prefs.settings.value("PEP8/ShowIgnored", False)))
         self.lineLengthSpinBox.setValue(int(Preferences.Prefs.settings.value(
             "PEP8/MaxLineLength", pycodestyle.MAX_LINE_LENGTH)))
+        self.blankBeforeTopLevelSpinBox.setValue(
+            int(Preferences.Prefs.settings.value(
+            "PEP8/BlankLinesBeforeTopLevel", 2)))
+        self.blankBeforeMethodSpinBox.setValue(
+            int(Preferences.Prefs.settings.value(
+            "PEP8/BlankLinesBeforeMethod", 1)))
         self.hangClosingCheckBox.setChecked(Preferences.toBool(
             Preferences.Prefs.settings.value("PEP8/HangClosing", False)))
         self.docTypeComboBox.setCurrentIndex(self.docTypeComboBox.findData(
@@ -1002,6 +1021,12 @@
         Preferences.Prefs.settings.setValue(
             "PEP8/MaxLineLength", self.lineLengthSpinBox.value())
         Preferences.Prefs.settings.setValue(
+            "PEP8/BlankLinesBeforeTopLevel",
+            self.blankBeforeTopLevelSpinBox.value())
+        Preferences.Prefs.settings.setValue(
+            "PEP8/BlankLinesBeforeMethod",
+            self.blankBeforeMethodSpinBox.value())
+        Preferences.Prefs.settings.setValue(
             "PEP8/HangClosing", self.hangClosingCheckBox.isChecked())
         Preferences.Prefs.settings.setValue(
             "PEP8/DocstringType", self.docTypeComboBox.itemData(
@@ -1040,6 +1065,10 @@
         Preferences.Prefs.settings.setValue("PEP8/ShowIgnored", False)
         Preferences.Prefs.settings.setValue(
             "PEP8/MaxLineLength", pycodestyle.MAX_LINE_LENGTH)
+        Preferences.Prefs.settings.setValue(
+            "PEP8/BlankLinesBeforeTopLevel", 2)
+        Preferences.Prefs.settings.setValue(
+            "PEP8/BlankLinesBeforeMethod", 1)
         Preferences.Prefs.settings.setValue("PEP8/HangClosing", False)
         Preferences.Prefs.settings.setValue("PEP8/DocstringType", "pep257")
         Preferences.Prefs.settings.setValue("PEP8/MaxCodeComplexity", 10)

eric ide

mercurial