eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py

changeset 7247
bf9379f964f3
parent 7229
53054eb5b15a
child 7256
4ef3b78ebb4e
equal deleted inserted replaced
7246:c32a350d2414 7247:bf9379f964f3
349 } 349 }
350 if "CommentedCodeChecker" not in self.__data: 350 if "CommentedCodeChecker" not in self.__data:
351 self.__data["CommentedCodeChecker"] = { 351 self.__data["CommentedCodeChecker"] = {
352 "Aggressive": False, 352 "Aggressive": False,
353 } 353 }
354 if "AnnotationsChecker" not in self.__data:
355 self.__data["AnnotationsChecker"] = {
356 "MinimumCoverage": 75,
357 "MaximumComplexity": 3,
358 }
354 359
355 self.excludeFilesEdit.setText(self.__data["ExcludeFiles"]) 360 self.excludeFilesEdit.setText(self.__data["ExcludeFiles"])
356 self.excludeMessagesEdit.setText(self.__data["ExcludeMessages"]) 361 self.excludeMessagesEdit.setText(self.__data["ExcludeMessages"])
357 self.includeMessagesEdit.setText(self.__data["IncludeMessages"]) 362 self.includeMessagesEdit.setText(self.__data["IncludeMessages"])
358 self.repeatCheckBox.setChecked(self.__data["RepeatMessages"]) 363 self.repeatCheckBox.setChecked(self.__data["RepeatMessages"])
377 self.copyrightAuthorEdit.setText(self.__data["CopyrightAuthor"]) 382 self.copyrightAuthorEdit.setText(self.__data["CopyrightAuthor"])
378 self.__initFuturesList(self.__data["FutureChecker"]) 383 self.__initFuturesList(self.__data["FutureChecker"])
379 self.__initBuiltinsIgnoreList(self.__data["BuiltinsChecker"]) 384 self.__initBuiltinsIgnoreList(self.__data["BuiltinsChecker"])
380 self.aggressiveCheckBox.setChecked( 385 self.aggressiveCheckBox.setChecked(
381 self.__data["CommentedCodeChecker"]["Aggressive"]) 386 self.__data["CommentedCodeChecker"]["Aggressive"])
387 self.minAnnotationsCoverageSpinBox.setValue(
388 self.__data["AnnotationsChecker"]["MinimumCoverage"])
389 self.maxAnnotationsComplexitySpinBox.setValue(
390 self.__data["AnnotationsChecker"]["MaximumComplexity"])
382 391
383 def start(self, fn, save=False, repeat=None): 392 def start(self, fn, save=False, repeat=None):
384 """ 393 """
385 Public slot to start the code style check. 394 Public slot to start the code style check.
386 395
477 "BuiltinsChecker": self.__getBuiltinsIgnoreList(), 486 "BuiltinsChecker": self.__getBuiltinsIgnoreList(),
478 "CommentedCodeChecker": { 487 "CommentedCodeChecker": {
479 "Aggressive": self.aggressiveCheckBox.isChecked(), 488 "Aggressive": self.aggressiveCheckBox.isChecked(),
480 } 489 }
481 } 490 }
491 annotationArgs = {
492 "MinimumCoverage":
493 self.minAnnotationsCoverageSpinBox.value(),
494 "MaximumComplexity":
495 self.maxAnnotationsComplexitySpinBox.value(),
496 }
482 497
483 self.__options = [excludeMessages, includeMessages, repeatMessages, 498 self.__options = [excludeMessages, includeMessages, repeatMessages,
484 fixCodes, noFixCodes, fixIssues, maxLineLength, 499 fixCodes, noFixCodes, fixIssues, maxLineLength,
485 maxDocLineLength, blankLines, hangClosing, 500 maxDocLineLength, blankLines, hangClosing,
486 docType, codeComplexityArgs, miscellaneousArgs] 501 docType, codeComplexityArgs, miscellaneousArgs,
502 annotationArgs]
487 503
488 # now go through all the files 504 # now go through all the files
489 self.progress = 0 505 self.progress = 0
490 self.files.sort() 506 self.files.sort()
491 if len(self.files) == 1: 507 if len(self.files) == 1:
811 "CopyrightAuthor": self.copyrightAuthorEdit.text(), 827 "CopyrightAuthor": self.copyrightAuthorEdit.text(),
812 "FutureChecker": self.__getSelectedFutureImports(), 828 "FutureChecker": self.__getSelectedFutureImports(),
813 "BuiltinsChecker": self.__getBuiltinsIgnoreList(), 829 "BuiltinsChecker": self.__getBuiltinsIgnoreList(),
814 "CommentedCodeChecker": { 830 "CommentedCodeChecker": {
815 "Aggressive": self.aggressiveCheckBox.isChecked(), 831 "Aggressive": self.aggressiveCheckBox.isChecked(),
832 },
833 "AnnotationsChecker": {
834 "MinimumCoverage":
835 self.minAnnotationsCoverageSpinBox.value(),
836 "MaximumComplexity":
837 self.maxAnnotationsComplexitySpinBox.value(),
816 } 838 }
817 } 839 }
818 if data != self.__data: 840 if data != self.__data:
819 self.__data = data 841 self.__data = data
820 self.__project.setData("CHECKERSPARMS", "Pep8Checker", 842 self.__project.setData("CHECKERSPARMS", "Pep8Checker",
1016 "str": ["unicode", ], 1038 "str": ["unicode", ],
1017 "chr": ["unichr", ], 1039 "chr": ["unichr", ],
1018 }))) 1040 })))
1019 self.aggressiveCheckBox.setChecked(Preferences.toBool( 1041 self.aggressiveCheckBox.setChecked(Preferences.toBool(
1020 Preferences.Prefs.settings.value("PEP8/AggressiveSearch", False))) 1042 Preferences.Prefs.settings.value("PEP8/AggressiveSearch", False)))
1043 self.minAnnotationsCoverageSpinBox.setValue(int(
1044 Preferences.Prefs.settings.value(
1045 "PEP8/MinimumAnnotationsCoverage", 75)))
1046 self.maxAnnotationsComplexitySpinBox.setValue(int(
1047 Preferences.Prefs.settings.value(
1048 "PEP8/MaximumAnnotationComplexity", 3)))
1021 1049
1022 @pyqtSlot() 1050 @pyqtSlot()
1023 def on_storeDefaultButton_clicked(self): 1051 def on_storeDefaultButton_clicked(self):
1024 """ 1052 """
1025 Private slot to store the current configuration values as 1053 Private slot to store the current configuration values as
1073 "PEP8/FutureChecker", self.__getSelectedFutureImports()) 1101 "PEP8/FutureChecker", self.__getSelectedFutureImports())
1074 Preferences.Prefs.settings.setValue( 1102 Preferences.Prefs.settings.setValue(
1075 "PEP8/BuiltinsChecker", self.__getBuiltinsIgnoreList()) 1103 "PEP8/BuiltinsChecker", self.__getBuiltinsIgnoreList())
1076 Preferences.Prefs.settings.setValue( 1104 Preferences.Prefs.settings.setValue(
1077 "PEP8/AggressiveSearch", self.aggressiveCheckBox.isChecked()) 1105 "PEP8/AggressiveSearch", self.aggressiveCheckBox.isChecked())
1106 Preferences.Prefs.settings.setValue(
1107 "PEP8/MinimumAnnotationsCoverage",
1108 self.minAnnotationsCoverageSpinBox.value())
1109 Preferences.Prefs.settings.setValue(
1110 "PEP8/MaximumAnnotationComplexity",
1111 self.maxAnnotationsComplexitySpinBox.value())
1078 1112
1079 @pyqtSlot() 1113 @pyqtSlot()
1080 def on_resetDefaultButton_clicked(self): 1114 def on_resetDefaultButton_clicked(self):
1081 """ 1115 """
1082 Private slot to reset the configuration values to their default values. 1116 Private slot to reset the configuration values to their default values.
1112 Preferences.Prefs.settings.setValue("PEP8/BuiltinsChecker", { 1146 Preferences.Prefs.settings.setValue("PEP8/BuiltinsChecker", {
1113 "str": ["unicode", ], 1147 "str": ["unicode", ],
1114 "chr": ["unichr", ], 1148 "chr": ["unichr", ],
1115 }) 1149 })
1116 Preferences.Prefs.settings.setValue("PEP8/AggressiveSearch", False) 1150 Preferences.Prefs.settings.setValue("PEP8/AggressiveSearch", False)
1151 Preferences.Prefs.settings.setValue(
1152 "PEP8/MinimumAnnotationsCoverage", 75)
1153 Preferences.Prefs.settings.setValue(
1154 "PEP8/MaximumAnnotationComplexity", 3)
1117 1155
1118 # Update UI with default values 1156 # Update UI with default values
1119 self.on_loadDefaultButton_clicked() 1157 self.on_loadDefaultButton_clicked()
1120 1158
1121 @pyqtSlot(QAbstractButton) 1159 @pyqtSlot(QAbstractButton)

eric ide

mercurial