Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py

changeset 6264
04a671fa4adb
parent 6188
5a6ae3be31e6
child 6265
56bd09c4c297
equal deleted inserted replaced
6263:4dd53711d869 6264:04a671fa4adb
313 "FixCodes": "", 313 "FixCodes": "",
314 "FixIssues": False, 314 "FixIssues": False,
315 } 315 }
316 if "MaxLineLength" not in self.__data: 316 if "MaxLineLength" not in self.__data:
317 self.__data["MaxLineLength"] = pycodestyle.MAX_LINE_LENGTH 317 self.__data["MaxLineLength"] = pycodestyle.MAX_LINE_LENGTH
318 if "BlankLines" not in self.__data:
319 self.__data["BlankLines"] = (2, 1)
320 # top level, method
318 if "HangClosing" not in self.__data: 321 if "HangClosing" not in self.__data:
319 self.__data["HangClosing"] = False 322 self.__data["HangClosing"] = False
320 if "NoFixCodes" not in self.__data: 323 if "NoFixCodes" not in self.__data:
321 self.__data["NoFixCodes"] = "E501" 324 self.__data["NoFixCodes"] = "E501"
322 if "DocstringType" not in self.__data: 325 if "DocstringType" not in self.__data:
350 self.fixIssuesEdit.setText(self.__data["FixCodes"]) 353 self.fixIssuesEdit.setText(self.__data["FixCodes"])
351 self.noFixIssuesEdit.setText(self.__data["NoFixCodes"]) 354 self.noFixIssuesEdit.setText(self.__data["NoFixCodes"])
352 self.fixIssuesCheckBox.setChecked(self.__data["FixIssues"]) 355 self.fixIssuesCheckBox.setChecked(self.__data["FixIssues"])
353 self.ignoredCheckBox.setChecked(self.__data["ShowIgnored"]) 356 self.ignoredCheckBox.setChecked(self.__data["ShowIgnored"])
354 self.lineLengthSpinBox.setValue(self.__data["MaxLineLength"]) 357 self.lineLengthSpinBox.setValue(self.__data["MaxLineLength"])
358 self.blankBeforeTopLevelSpinBox.setValue(self.__data["BlankLines"][0])
359 self.blankBeforeMethodSpinBox.setValue(self.__data["BlankLines"][1])
355 self.hangClosingCheckBox.setChecked(self.__data["HangClosing"]) 360 self.hangClosingCheckBox.setChecked(self.__data["HangClosing"])
356 self.docTypeComboBox.setCurrentIndex( 361 self.docTypeComboBox.setCurrentIndex(
357 self.docTypeComboBox.findData(self.__data["DocstringType"])) 362 self.docTypeComboBox.findData(self.__data["DocstringType"]))
358 self.complexitySpinBox.setValue(self.__data["MaxCodeComplexity"]) 363 self.complexitySpinBox.setValue(self.__data["MaxCodeComplexity"])
359 self.lineComplexitySpinBox.setValue(self.__data["LineComplexity"]) 364 self.lineComplexitySpinBox.setValue(self.__data["LineComplexity"])
438 [c.strip() for c in noFixCodes.split(",") if c.strip()] 443 [c.strip() for c in noFixCodes.split(",") if c.strip()]
439 fixIssues = self.fixIssuesCheckBox.isChecked() and repeatMessages 444 fixIssues = self.fixIssuesCheckBox.isChecked() and repeatMessages
440 self.showIgnored = self.ignoredCheckBox.isChecked() and \ 445 self.showIgnored = self.ignoredCheckBox.isChecked() and \
441 repeatMessages 446 repeatMessages
442 maxLineLength = self.lineLengthSpinBox.value() 447 maxLineLength = self.lineLengthSpinBox.value()
448 blankLines = (
449 self.blankBeforeTopLevelSpinBox.value(),
450 self.blankBeforeMethodSpinBox.value()
451 )
443 hangClosing = self.hangClosingCheckBox.isChecked() 452 hangClosing = self.hangClosingCheckBox.isChecked()
444 docType = self.docTypeComboBox.itemData( 453 docType = self.docTypeComboBox.itemData(
445 self.docTypeComboBox.currentIndex()) 454 self.docTypeComboBox.currentIndex())
446 codeComplexityArgs = { 455 codeComplexityArgs = {
447 "McCabeComplexity": self.complexitySpinBox.value(), 456 "McCabeComplexity": self.complexitySpinBox.value(),
458 "BuiltinsChecker": self.__getBuiltinsIgnoreList(), 467 "BuiltinsChecker": self.__getBuiltinsIgnoreList(),
459 } 468 }
460 469
461 self.__options = [excludeMessages, includeMessages, repeatMessages, 470 self.__options = [excludeMessages, includeMessages, repeatMessages,
462 fixCodes, noFixCodes, fixIssues, maxLineLength, 471 fixCodes, noFixCodes, fixIssues, maxLineLength,
463 hangClosing, docType, codeComplexityArgs, 472 blankLines, hangClosing, docType,
464 miscellaneousArgs] 473 codeComplexityArgs, miscellaneousArgs]
465 474
466 # now go through all the files 475 # now go through all the files
467 self.progress = 0 476 self.progress = 0
468 self.files.sort() 477 self.files.sort()
469 if len(self.files) == 1: 478 if len(self.files) == 1:
771 "FixCodes": self.fixIssuesEdit.text(), 780 "FixCodes": self.fixIssuesEdit.text(),
772 "NoFixCodes": self.noFixIssuesEdit.text(), 781 "NoFixCodes": self.noFixIssuesEdit.text(),
773 "FixIssues": self.fixIssuesCheckBox.isChecked(), 782 "FixIssues": self.fixIssuesCheckBox.isChecked(),
774 "ShowIgnored": self.ignoredCheckBox.isChecked(), 783 "ShowIgnored": self.ignoredCheckBox.isChecked(),
775 "MaxLineLength": self.lineLengthSpinBox.value(), 784 "MaxLineLength": self.lineLengthSpinBox.value(),
785 "BlankLines": (
786 self.blankBeforeTopLevelSpinBox.value(),
787 self.blankBeforeMethodSpinBox.value()
788 ),
776 "HangClosing": self.hangClosingCheckBox.isChecked(), 789 "HangClosing": self.hangClosingCheckBox.isChecked(),
777 "DocstringType": self.docTypeComboBox.itemData( 790 "DocstringType": self.docTypeComboBox.itemData(
778 self.docTypeComboBox.currentIndex()), 791 self.docTypeComboBox.currentIndex()),
779 "MaxCodeComplexity": self.complexitySpinBox.value(), 792 "MaxCodeComplexity": self.complexitySpinBox.value(),
780 "LineComplexity": self.lineComplexitySpinBox.value(), 793 "LineComplexity": self.lineComplexitySpinBox.value(),
949 Preferences.Prefs.settings.value("PEP8/FixIssues", False))) 962 Preferences.Prefs.settings.value("PEP8/FixIssues", False)))
950 self.ignoredCheckBox.setChecked(Preferences.toBool( 963 self.ignoredCheckBox.setChecked(Preferences.toBool(
951 Preferences.Prefs.settings.value("PEP8/ShowIgnored", False))) 964 Preferences.Prefs.settings.value("PEP8/ShowIgnored", False)))
952 self.lineLengthSpinBox.setValue(int(Preferences.Prefs.settings.value( 965 self.lineLengthSpinBox.setValue(int(Preferences.Prefs.settings.value(
953 "PEP8/MaxLineLength", pycodestyle.MAX_LINE_LENGTH))) 966 "PEP8/MaxLineLength", pycodestyle.MAX_LINE_LENGTH)))
967 self.blankBeforeTopLevelSpinBox.setValue(
968 int(Preferences.Prefs.settings.value(
969 "PEP8/BlankLinesBeforeTopLevel", 2)))
970 self.blankBeforeMethodSpinBox.setValue(
971 int(Preferences.Prefs.settings.value(
972 "PEP8/BlankLinesBeforeMethod", 1)))
954 self.hangClosingCheckBox.setChecked(Preferences.toBool( 973 self.hangClosingCheckBox.setChecked(Preferences.toBool(
955 Preferences.Prefs.settings.value("PEP8/HangClosing", False))) 974 Preferences.Prefs.settings.value("PEP8/HangClosing", False)))
956 self.docTypeComboBox.setCurrentIndex(self.docTypeComboBox.findData( 975 self.docTypeComboBox.setCurrentIndex(self.docTypeComboBox.findData(
957 Preferences.Prefs.settings.value("PEP8/DocstringType", "pep257"))) 976 Preferences.Prefs.settings.value("PEP8/DocstringType", "pep257")))
958 self.complexitySpinBox.setValue(int(Preferences.Prefs.settings.value( 977 self.complexitySpinBox.setValue(int(Preferences.Prefs.settings.value(
1000 Preferences.Prefs.settings.setValue( 1019 Preferences.Prefs.settings.setValue(
1001 "PEP8/ShowIgnored", self.ignoredCheckBox.isChecked()) 1020 "PEP8/ShowIgnored", self.ignoredCheckBox.isChecked())
1002 Preferences.Prefs.settings.setValue( 1021 Preferences.Prefs.settings.setValue(
1003 "PEP8/MaxLineLength", self.lineLengthSpinBox.value()) 1022 "PEP8/MaxLineLength", self.lineLengthSpinBox.value())
1004 Preferences.Prefs.settings.setValue( 1023 Preferences.Prefs.settings.setValue(
1024 "PEP8/BlankLinesBeforeTopLevel",
1025 self.blankBeforeTopLevelSpinBox.value())
1026 Preferences.Prefs.settings.setValue(
1027 "PEP8/BlankLinesBeforeMethod",
1028 self.blankBeforeMethodSpinBox.value())
1029 Preferences.Prefs.settings.setValue(
1005 "PEP8/HangClosing", self.hangClosingCheckBox.isChecked()) 1030 "PEP8/HangClosing", self.hangClosingCheckBox.isChecked())
1006 Preferences.Prefs.settings.setValue( 1031 Preferences.Prefs.settings.setValue(
1007 "PEP8/DocstringType", self.docTypeComboBox.itemData( 1032 "PEP8/DocstringType", self.docTypeComboBox.itemData(
1008 self.docTypeComboBox.currentIndex())) 1033 self.docTypeComboBox.currentIndex()))
1009 Preferences.Prefs.settings.setValue( 1034 Preferences.Prefs.settings.setValue(
1038 Preferences.Prefs.settings.setValue("PEP8/NoFixCodes", "E501") 1063 Preferences.Prefs.settings.setValue("PEP8/NoFixCodes", "E501")
1039 Preferences.Prefs.settings.setValue("PEP8/FixIssues", False) 1064 Preferences.Prefs.settings.setValue("PEP8/FixIssues", False)
1040 Preferences.Prefs.settings.setValue("PEP8/ShowIgnored", False) 1065 Preferences.Prefs.settings.setValue("PEP8/ShowIgnored", False)
1041 Preferences.Prefs.settings.setValue( 1066 Preferences.Prefs.settings.setValue(
1042 "PEP8/MaxLineLength", pycodestyle.MAX_LINE_LENGTH) 1067 "PEP8/MaxLineLength", pycodestyle.MAX_LINE_LENGTH)
1068 Preferences.Prefs.settings.setValue(
1069 "PEP8/BlankLinesBeforeTopLevel", 2)
1070 Preferences.Prefs.settings.setValue(
1071 "PEP8/BlankLinesBeforeMethod", 1)
1043 Preferences.Prefs.settings.setValue("PEP8/HangClosing", False) 1072 Preferences.Prefs.settings.setValue("PEP8/HangClosing", False)
1044 Preferences.Prefs.settings.setValue("PEP8/DocstringType", "pep257") 1073 Preferences.Prefs.settings.setValue("PEP8/DocstringType", "pep257")
1045 Preferences.Prefs.settings.setValue("PEP8/MaxCodeComplexity", 10) 1074 Preferences.Prefs.settings.setValue("PEP8/MaxCodeComplexity", 10)
1046 Preferences.Prefs.settings.setValue("PEP8/LineComplexity", 15) 1075 Preferences.Prefs.settings.setValue("PEP8/LineComplexity", 15)
1047 Preferences.Prefs.settings.setValue("PEP8/LineComplexityScore", 10) 1076 Preferences.Prefs.settings.setValue("PEP8/LineComplexityScore", 10)

eric ide

mercurial