--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Mon Feb 18 19:14:05 2019 +0100 +++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Tue Feb 19 18:16:45 2019 +0100 @@ -315,6 +315,9 @@ } if "MaxLineLength" not in self.__data: self.__data["MaxLineLength"] = pycodestyle.MAX_LINE_LENGTH + if "MaxDocLineLength" not in self.__data: + # Use MAX_LINE_LENGTH to avoid messages on existing code + self.__data["MaxDocLineLength"] = pycodestyle.MAX_LINE_LENGTH if "BlankLines" not in self.__data: self.__data["BlankLines"] = (2, 1) # top level, method @@ -355,6 +358,7 @@ self.fixIssuesCheckBox.setChecked(self.__data["FixIssues"]) self.ignoredCheckBox.setChecked(self.__data["ShowIgnored"]) self.lineLengthSpinBox.setValue(self.__data["MaxLineLength"]) + self.docLineLengthSpinBox.setValue(self.__data["MaxDocLineLength"]) self.blankBeforeTopLevelSpinBox.setValue(self.__data["BlankLines"][0]) self.blankBeforeMethodSpinBox.setValue(self.__data["BlankLines"][1]) self.hangClosingCheckBox.setChecked(self.__data["HangClosing"]) @@ -445,6 +449,7 @@ self.showIgnored = self.ignoredCheckBox.isChecked() and \ repeatMessages maxLineLength = self.lineLengthSpinBox.value() + maxDocLineLength = self.docLineLengthSpinBox.value() blankLines = ( self.blankBeforeTopLevelSpinBox.value(), self.blankBeforeMethodSpinBox.value() @@ -469,8 +474,8 @@ self.__options = [excludeMessages, includeMessages, repeatMessages, fixCodes, noFixCodes, fixIssues, maxLineLength, - blankLines, hangClosing, docType, - codeComplexityArgs, miscellaneousArgs] + maxDocLineLength, blankLines, hangClosing, + docType, codeComplexityArgs, miscellaneousArgs] # now go through all the files self.progress = 0 @@ -782,6 +787,7 @@ "FixIssues": self.fixIssuesCheckBox.isChecked(), "ShowIgnored": self.ignoredCheckBox.isChecked(), "MaxLineLength": self.lineLengthSpinBox.value(), + "MaxDocLineLength": self.docLineLengthSpinBox.value(), "BlankLines": ( self.blankBeforeTopLevelSpinBox.value(), self.blankBeforeMethodSpinBox.value() @@ -964,6 +970,10 @@ Preferences.Prefs.settings.value("PEP8/ShowIgnored", False))) self.lineLengthSpinBox.setValue(int(Preferences.Prefs.settings.value( "PEP8/MaxLineLength", pycodestyle.MAX_LINE_LENGTH))) + # Use MAX_LINE_LENGTH to avoid messages on existing code + self.docLineLengthSpinBox.setValue(int( + Preferences.Prefs.settings.value( + "PEP8/MaxDocLineLength", pycodestyle.MAX_LINE_LENGTH))) self.blankBeforeTopLevelSpinBox.setValue( int(Preferences.Prefs.settings.value( "PEP8/BlankLinesBeforeTopLevel", 2))) @@ -1021,6 +1031,8 @@ Preferences.Prefs.settings.setValue( "PEP8/MaxLineLength", self.lineLengthSpinBox.value()) Preferences.Prefs.settings.setValue( + "PEP8/MaxDocLineLength", self.docLineLengthSpinBox.value()) + Preferences.Prefs.settings.setValue( "PEP8/BlankLinesBeforeTopLevel", self.blankBeforeTopLevelSpinBox.value()) Preferences.Prefs.settings.setValue( @@ -1065,6 +1077,9 @@ Preferences.Prefs.settings.setValue("PEP8/ShowIgnored", False) Preferences.Prefs.settings.setValue( "PEP8/MaxLineLength", pycodestyle.MAX_LINE_LENGTH) + # Hard reset to pycodestyle preferences + Preferences.Prefs.settings.setValue( + "PEP8/MaxDocLineLength", pycodestyle.MAX_DOC_LENGTH) Preferences.Prefs.settings.setValue( "PEP8/BlankLinesBeforeTopLevel", 2) Preferences.Prefs.settings.setValue( @@ -1083,6 +1098,8 @@ "str": ["unicode", ], "chr": ["unichr", ], }) + # Update UI with default values + self.on_loadDefaultButton_clicked() @pyqtSlot(QAbstractButton) def on_buttonBox_clicked(self, button):