246 self.__lastFileItem.setExpanded(True) |
246 self.__lastFileItem.setExpanded(True) |
247 self.__lastFileItem.setData(0, self.filenameRole, filename) |
247 self.__lastFileItem.setData(0, self.filenameRole, filename) |
248 |
248 |
249 fixable = False |
249 fixable = False |
250 itm = QTreeWidgetItem( |
250 itm = QTreeWidgetItem( |
251 self.__lastFileItem, |
251 self.__lastFileItem, [ |
252 ["{0:6}".format(result["line"]), result["code"], |
252 "{0:6}".format(result["line"]), |
253 result["display"]]) |
253 result["code"], |
|
254 result["display"] |
|
255 ] |
|
256 ) |
254 if result["code"].startswith(("W", "-", "C", "M")): |
257 if result["code"].startswith(("W", "-", "C", "M")): |
255 itm.setIcon(1, UI.PixmapCache.getIcon("warning")) |
258 itm.setIcon(1, UI.PixmapCache.getIcon("warning")) |
256 elif result["code"].startswith(("A", "N")): |
259 elif result["code"].startswith(("A", "N")): |
257 itm.setIcon(1, UI.PixmapCache.getIcon("namingError")) |
260 itm.setIcon(1, UI.PixmapCache.getIcon("namingError")) |
258 elif result["code"].startswith("D"): |
261 elif result["code"].startswith("D"): |
291 itm.setData(0, self.filenameRole, filename) |
294 itm.setData(0, self.filenameRole, filename) |
292 itm.setData(0, self.lineRole, int(result["line"])) |
295 itm.setData(0, self.lineRole, int(result["line"])) |
293 itm.setData(0, self.positionRole, int(result["offset"])) |
296 itm.setData(0, self.positionRole, int(result["offset"])) |
294 itm.setData(0, self.messageRole, result["display"]) |
297 itm.setData(0, self.messageRole, result["display"]) |
295 itm.setData(0, self.fixableRole, fixable) |
298 itm.setData(0, self.fixableRole, fixable) |
296 itm.setData(0, self.codeRole, result["code"]) |
299 itm.setData(0, self.codeRole, result["code"].split(".", 1)[0]) |
297 itm.setData(0, self.ignoredRole, result["ignored"]) |
300 itm.setData(0, self.ignoredRole, result["ignored"]) |
298 itm.setData(0, self.argsRole, result["args"]) |
301 itm.setData(0, self.argsRole, result["args"]) |
299 |
302 |
300 if result["ignored"]: |
303 if result["ignored"]: |
301 font = itm.font(0) |
304 font = itm.font(0) |
446 self.__data["AnnotationsChecker"] = { |
449 self.__data["AnnotationsChecker"] = { |
447 "MinimumCoverage": 75, |
450 "MinimumCoverage": 75, |
448 "MaximumComplexity": 3, |
451 "MaximumComplexity": 3, |
449 } |
452 } |
450 |
453 |
|
454 # TODO: add 'SecurityChecker' |
|
455 |
451 self.__initCategoriesList(self.__data["EnabledCheckerCategories"]) |
456 self.__initCategoriesList(self.__data["EnabledCheckerCategories"]) |
452 self.excludeFilesEdit.setText(self.__data["ExcludeFiles"]) |
457 self.excludeFilesEdit.setText(self.__data["ExcludeFiles"]) |
453 self.excludeMessagesEdit.setText(self.__data["ExcludeMessages"]) |
458 self.excludeMessagesEdit.setText(self.__data["ExcludeMessages"]) |
454 self.includeMessagesEdit.setText(self.__data["IncludeMessages"]) |
459 self.includeMessagesEdit.setText(self.__data["IncludeMessages"]) |
455 self.repeatCheckBox.setChecked(self.__data["RepeatMessages"]) |
460 self.repeatCheckBox.setChecked(self.__data["RepeatMessages"]) |
594 self.minAnnotationsCoverageSpinBox.value(), |
599 self.minAnnotationsCoverageSpinBox.value(), |
595 "MaximumComplexity": |
600 "MaximumComplexity": |
596 self.maxAnnotationsComplexitySpinBox.value(), |
601 self.maxAnnotationsComplexitySpinBox.value(), |
597 } |
602 } |
598 |
603 |
599 # TODO: implement safety arguments |
604 # TODO: add 'SecurityChecker' |
600 safetyArgs = {} |
605 safetyArgs = {} |
601 |
606 |
602 self.__options = [excludeMessages, includeMessages, repeatMessages, |
607 self.__options = [excludeMessages, includeMessages, repeatMessages, |
603 fixCodes, noFixCodes, fixIssues, maxLineLength, |
608 fixCodes, noFixCodes, fixIssues, maxLineLength, |
604 maxDocLineLength, blankLines, hangClosing, |
609 maxDocLineLength, blankLines, hangClosing, |
942 "MinimumCoverage": |
947 "MinimumCoverage": |
943 self.minAnnotationsCoverageSpinBox.value(), |
948 self.minAnnotationsCoverageSpinBox.value(), |
944 "MaximumComplexity": |
949 "MaximumComplexity": |
945 self.maxAnnotationsComplexitySpinBox.value(), |
950 self.maxAnnotationsComplexitySpinBox.value(), |
946 } |
951 } |
|
952 |
|
953 # TODO: add 'SecurityChecker' |
947 } |
954 } |
948 if data != self.__data: |
955 if data != self.__data: |
949 self.__data = data |
956 self.__data = data |
950 self.__project.setData("CHECKERSPARMS", "Pep8Checker", |
957 self.__project.setData("CHECKERSPARMS", "Pep8Checker", |
951 self.__data) |
958 self.__data) |
1039 |
1046 |
1040 vm = e5App().getObject("ViewManager") |
1047 vm = e5App().getObject("ViewManager") |
1041 vm.openSourceFile(fn, lineno=lineno, pos=position + 1) |
1048 vm.openSourceFile(fn, lineno=lineno, pos=position + 1) |
1042 editor = vm.getOpenEditor(fn) |
1049 editor = vm.getOpenEditor(fn) |
1043 |
1050 |
|
1051 # TODO: add other syntax errors or do syntax check once for all |
1044 if code in ["E901", "E902"]: |
1052 if code in ["E901", "E902"]: |
1045 editor.toggleSyntaxError(lineno, 0, True, message, True) |
1053 editor.toggleSyntaxError(lineno, 0, True, message, True) |
1046 else: |
1054 else: |
1047 editor.toggleWarning( |
1055 editor.toggleWarning( |
1048 lineno, 0, True, message, warningType=editor.WarningStyle) |
1056 lineno, 0, True, message, warningType=editor.WarningStyle) |
1175 "PEP8/MinimumAnnotationsCoverage", 75))) |
1183 "PEP8/MinimumAnnotationsCoverage", 75))) |
1176 self.maxAnnotationsComplexitySpinBox.setValue(int( |
1184 self.maxAnnotationsComplexitySpinBox.setValue(int( |
1177 Preferences.Prefs.settings.value( |
1185 Preferences.Prefs.settings.value( |
1178 "PEP8/MaximumAnnotationComplexity", 3))) |
1186 "PEP8/MaximumAnnotationComplexity", 3))) |
1179 |
1187 |
|
1188 # TODO: add 'SecurityChecker' |
|
1189 |
1180 self.__cleanupData() |
1190 self.__cleanupData() |
1181 |
1191 |
1182 @pyqtSlot() |
1192 @pyqtSlot() |
1183 def on_storeDefaultButton_clicked(self): |
1193 def on_storeDefaultButton_clicked(self): |
1184 """ |
1194 """ |
1241 "PEP8/MinimumAnnotationsCoverage", |
1251 "PEP8/MinimumAnnotationsCoverage", |
1242 self.minAnnotationsCoverageSpinBox.value()) |
1252 self.minAnnotationsCoverageSpinBox.value()) |
1243 Preferences.Prefs.settings.setValue( |
1253 Preferences.Prefs.settings.setValue( |
1244 "PEP8/MaximumAnnotationComplexity", |
1254 "PEP8/MaximumAnnotationComplexity", |
1245 self.maxAnnotationsComplexitySpinBox.value()) |
1255 self.maxAnnotationsComplexitySpinBox.value()) |
|
1256 |
|
1257 # TODO: add 'SecurityChecker' |
1246 |
1258 |
1247 @pyqtSlot() |
1259 @pyqtSlot() |
1248 def on_resetDefaultButton_clicked(self): |
1260 def on_resetDefaultButton_clicked(self): |
1249 """ |
1261 """ |
1250 Private slot to reset the configuration values to their default values. |
1262 Private slot to reset the configuration values to their default values. |
1287 Preferences.Prefs.settings.setValue("PEP8/AggressiveSearch", False) |
1299 Preferences.Prefs.settings.setValue("PEP8/AggressiveSearch", False) |
1288 Preferences.Prefs.settings.setValue( |
1300 Preferences.Prefs.settings.setValue( |
1289 "PEP8/MinimumAnnotationsCoverage", 75) |
1301 "PEP8/MinimumAnnotationsCoverage", 75) |
1290 Preferences.Prefs.settings.setValue( |
1302 Preferences.Prefs.settings.setValue( |
1291 "PEP8/MaximumAnnotationComplexity", 3) |
1303 "PEP8/MaximumAnnotationComplexity", 3) |
|
1304 |
|
1305 # TODO: add 'SecurityChecker' |
1292 |
1306 |
1293 # Update UI with default values |
1307 # Update UI with default values |
1294 self.on_loadDefaultButton_clicked() |
1308 self.on_loadDefaultButton_clicked() |
1295 |
1309 |
1296 @pyqtSlot(QAbstractButton) |
1310 @pyqtSlot(QAbstractButton) |