62 @param parent reference to the parent widget (QWidget) |
62 @param parent reference to the parent widget (QWidget) |
63 """ |
63 """ |
64 super(CodeStyleCheckerDialog, self).__init__(parent) |
64 super(CodeStyleCheckerDialog, self).__init__(parent) |
65 self.setupUi(self) |
65 self.setupUi(self) |
66 self.setWindowFlags(Qt.Window) |
66 self.setWindowFlags(Qt.Window) |
|
67 |
|
68 self.optionsTabWidget.setCurrentIndex(0) |
67 |
69 |
68 self.excludeMessagesSelectButton.setIcon( |
70 self.excludeMessagesSelectButton.setIcon( |
69 UI.PixmapCache.getIcon("select.png")) |
71 UI.PixmapCache.getIcon("select.png")) |
70 self.includeMessagesSelectButton.setIcon( |
72 self.includeMessagesSelectButton.setIcon( |
71 UI.PixmapCache.getIcon("select.png")) |
73 UI.PixmapCache.getIcon("select.png")) |
321 self.__data["DocstringType"] = "pep257" |
323 self.__data["DocstringType"] = "pep257" |
322 if "ShowIgnored" not in self.__data: |
324 if "ShowIgnored" not in self.__data: |
323 self.__data["ShowIgnored"] = False |
325 self.__data["ShowIgnored"] = False |
324 if "MaxCodeComplexity" not in self.__data: |
326 if "MaxCodeComplexity" not in self.__data: |
325 self.__data["MaxCodeComplexity"] = 10 |
327 self.__data["MaxCodeComplexity"] = 10 |
|
328 if "LineComplexity" not in self.__data: |
|
329 self.__data["LineComplexity"] = 15 |
|
330 if "LineComplexityScore" not in self.__data: |
|
331 self.__data["LineComplexityScore"] = 10 |
326 if "ValidEncodings" not in self.__data: |
332 if "ValidEncodings" not in self.__data: |
327 self.__data["ValidEncodings"] = "latin-1, utf-8" |
333 self.__data["ValidEncodings"] = "latin-1, utf-8" |
328 if "CopyrightMinFileSize" not in self.__data or \ |
334 if "CopyrightMinFileSize" not in self.__data or \ |
329 "CopyrightAuthor" not in self.__data: |
335 "CopyrightAuthor" not in self.__data: |
330 self.__data["CopyrightMinFileSize"] = 0 |
336 self.__data["CopyrightMinFileSize"] = 0 |
348 self.lineLengthSpinBox.setValue(self.__data["MaxLineLength"]) |
354 self.lineLengthSpinBox.setValue(self.__data["MaxLineLength"]) |
349 self.hangClosingCheckBox.setChecked(self.__data["HangClosing"]) |
355 self.hangClosingCheckBox.setChecked(self.__data["HangClosing"]) |
350 self.docTypeComboBox.setCurrentIndex( |
356 self.docTypeComboBox.setCurrentIndex( |
351 self.docTypeComboBox.findData(self.__data["DocstringType"])) |
357 self.docTypeComboBox.findData(self.__data["DocstringType"])) |
352 self.complexitySpinBox.setValue(self.__data["MaxCodeComplexity"]) |
358 self.complexitySpinBox.setValue(self.__data["MaxCodeComplexity"]) |
|
359 self.lineComplexitySpinBox.setValue(self.__data["LineComplexity"]) |
|
360 self.lineComplexityScoreSpinBox.setValue( |
|
361 self.__data["LineComplexityScore"]) |
353 self.encodingsEdit.setText(self.__data["ValidEncodings"]) |
362 self.encodingsEdit.setText(self.__data["ValidEncodings"]) |
354 self.copyrightFileSizeSpinBox.setValue( |
363 self.copyrightFileSizeSpinBox.setValue( |
355 self.__data["CopyrightMinFileSize"]) |
364 self.__data["CopyrightMinFileSize"]) |
356 self.copyrightAuthorEdit.setText(self.__data["CopyrightAuthor"]) |
365 self.copyrightAuthorEdit.setText(self.__data["CopyrightAuthor"]) |
357 self.__initFuturesList(self.__data["FutureChecker"]) |
366 self.__initFuturesList(self.__data["FutureChecker"]) |
432 repeatMessages |
441 repeatMessages |
433 maxLineLength = self.lineLengthSpinBox.value() |
442 maxLineLength = self.lineLengthSpinBox.value() |
434 hangClosing = self.hangClosingCheckBox.isChecked() |
443 hangClosing = self.hangClosingCheckBox.isChecked() |
435 docType = self.docTypeComboBox.itemData( |
444 docType = self.docTypeComboBox.itemData( |
436 self.docTypeComboBox.currentIndex()) |
445 self.docTypeComboBox.currentIndex()) |
437 maxCodeComplexity = self.complexitySpinBox.value() |
446 codeComplexityArgs = { |
|
447 "McCabeComplexity": self.complexitySpinBox.value(), |
|
448 "LineComplexity": self.lineComplexitySpinBox.value(), |
|
449 "LineComplexityScore": self.lineComplexityScoreSpinBox.value(), |
|
450 } |
438 miscellaneousArgs = { |
451 miscellaneousArgs = { |
439 "CodingChecker": self.encodingsEdit.text(), |
452 "CodingChecker": self.encodingsEdit.text(), |
440 "CopyrightChecker": { |
453 "CopyrightChecker": { |
441 "MinFilesize": self.copyrightFileSizeSpinBox.value(), |
454 "MinFilesize": self.copyrightFileSizeSpinBox.value(), |
442 "Author": self.copyrightAuthorEdit.text(), |
455 "Author": self.copyrightAuthorEdit.text(), |
445 "BuiltinsChecker": self.__getBuiltinsIgnoreList(), |
458 "BuiltinsChecker": self.__getBuiltinsIgnoreList(), |
446 } |
459 } |
447 |
460 |
448 self.__options = [excludeMessages, includeMessages, repeatMessages, |
461 self.__options = [excludeMessages, includeMessages, repeatMessages, |
449 fixCodes, noFixCodes, fixIssues, maxLineLength, |
462 fixCodes, noFixCodes, fixIssues, maxLineLength, |
450 hangClosing, docType, maxCodeComplexity, |
463 hangClosing, docType, codeComplexityArgs, |
451 miscellaneousArgs] |
464 miscellaneousArgs] |
452 |
465 |
453 # now go through all the files |
466 # now go through all the files |
454 self.progress = 0 |
467 self.progress = 0 |
455 self.files.sort() |
468 self.files.sort() |
762 "MaxLineLength": self.lineLengthSpinBox.value(), |
775 "MaxLineLength": self.lineLengthSpinBox.value(), |
763 "HangClosing": self.hangClosingCheckBox.isChecked(), |
776 "HangClosing": self.hangClosingCheckBox.isChecked(), |
764 "DocstringType": self.docTypeComboBox.itemData( |
777 "DocstringType": self.docTypeComboBox.itemData( |
765 self.docTypeComboBox.currentIndex()), |
778 self.docTypeComboBox.currentIndex()), |
766 "MaxCodeComplexity": self.complexitySpinBox.value(), |
779 "MaxCodeComplexity": self.complexitySpinBox.value(), |
|
780 "LineComplexity": self.lineComplexitySpinBox.value(), |
|
781 "LineComplexityScore": self.lineComplexityScoreSpinBox.value(), |
767 "ValidEncodings": self.encodingsEdit.text(), |
782 "ValidEncodings": self.encodingsEdit.text(), |
768 "CopyrightMinFileSize": self.copyrightFileSizeSpinBox.value(), |
783 "CopyrightMinFileSize": self.copyrightFileSizeSpinBox.value(), |
769 "CopyrightAuthor": self.copyrightAuthorEdit.text(), |
784 "CopyrightAuthor": self.copyrightAuthorEdit.text(), |
770 "FutureChecker": self.__getSelectedFutureImports(), |
785 "FutureChecker": self.__getSelectedFutureImports(), |
771 "BuiltinsChecker": self.__getBuiltinsIgnoreList(), |
786 "BuiltinsChecker": self.__getBuiltinsIgnoreList(), |
940 Preferences.Prefs.settings.value("PEP8/HangClosing", False))) |
955 Preferences.Prefs.settings.value("PEP8/HangClosing", False))) |
941 self.docTypeComboBox.setCurrentIndex(self.docTypeComboBox.findData( |
956 self.docTypeComboBox.setCurrentIndex(self.docTypeComboBox.findData( |
942 Preferences.Prefs.settings.value("PEP8/DocstringType", "pep257"))) |
957 Preferences.Prefs.settings.value("PEP8/DocstringType", "pep257"))) |
943 self.complexitySpinBox.setValue(int(Preferences.Prefs.settings.value( |
958 self.complexitySpinBox.setValue(int(Preferences.Prefs.settings.value( |
944 "PEP8/MaxCodeComplexity", 10))) |
959 "PEP8/MaxCodeComplexity", 10))) |
|
960 self.lineComplexitySpinBox.setValue( |
|
961 int(Preferences.Prefs.settings.value( |
|
962 "PEP8/LineComplexity", 15))) |
|
963 self.lineComplexityScoreSpinBox.setValue( |
|
964 int(Preferences.Prefs.settings.value( |
|
965 "PEP8/LineComplexityScore", 10))) |
945 self.encodingsEdit.setText(Preferences.Prefs.settings.value( |
966 self.encodingsEdit.setText(Preferences.Prefs.settings.value( |
946 "PEP8/ValidEncodings", "latin-1, utf-8")) |
967 "PEP8/ValidEncodings", "latin-1, utf-8")) |
947 self.copyrightFileSizeSpinBox.setValue(int( |
968 self.copyrightFileSizeSpinBox.setValue(int( |
948 Preferences.Prefs.settings.value("PEP8/CopyrightMinFileSize", 0))) |
969 Preferences.Prefs.settings.value("PEP8/CopyrightMinFileSize", 0))) |
949 self.copyrightAuthorEdit.setText( |
970 self.copyrightAuthorEdit.setText( |
986 "PEP8/DocstringType", self.docTypeComboBox.itemData( |
1007 "PEP8/DocstringType", self.docTypeComboBox.itemData( |
987 self.docTypeComboBox.currentIndex())) |
1008 self.docTypeComboBox.currentIndex())) |
988 Preferences.Prefs.settings.setValue( |
1009 Preferences.Prefs.settings.setValue( |
989 "PEP8/MaxCodeComplexity", self.complexitySpinBox.value()) |
1010 "PEP8/MaxCodeComplexity", self.complexitySpinBox.value()) |
990 Preferences.Prefs.settings.setValue( |
1011 Preferences.Prefs.settings.setValue( |
|
1012 "PEP8/LineComplexity", self.lineComplexitySpinBox.value()) |
|
1013 Preferences.Prefs.settings.setValue( |
|
1014 "PEP8/LineComplexityScore", |
|
1015 self.lineComplexityScoreSpinBox.value()) |
|
1016 Preferences.Prefs.settings.setValue( |
991 "PEP8/ValidEncodings", self.encodingsEdit.text()) |
1017 "PEP8/ValidEncodings", self.encodingsEdit.text()) |
992 Preferences.Prefs.settings.setValue( |
1018 Preferences.Prefs.settings.setValue( |
993 "PEP8/CopyrightMinFileSize", self.copyrightFileSizeSpinBox.value()) |
1019 "PEP8/CopyrightMinFileSize", self.copyrightFileSizeSpinBox.value()) |
994 Preferences.Prefs.settings.setValue( |
1020 Preferences.Prefs.settings.setValue( |
995 "PEP8/CopyrightAuthor", self.copyrightAuthorEdit.text()) |
1021 "PEP8/CopyrightAuthor", self.copyrightAuthorEdit.text()) |
1015 Preferences.Prefs.settings.setValue( |
1041 Preferences.Prefs.settings.setValue( |
1016 "PEP8/MaxLineLength", pycodestyle.MAX_LINE_LENGTH) |
1042 "PEP8/MaxLineLength", pycodestyle.MAX_LINE_LENGTH) |
1017 Preferences.Prefs.settings.setValue("PEP8/HangClosing", False) |
1043 Preferences.Prefs.settings.setValue("PEP8/HangClosing", False) |
1018 Preferences.Prefs.settings.setValue("PEP8/DocstringType", "pep257") |
1044 Preferences.Prefs.settings.setValue("PEP8/DocstringType", "pep257") |
1019 Preferences.Prefs.settings.setValue("PEP8/MaxCodeComplexity", 10) |
1045 Preferences.Prefs.settings.setValue("PEP8/MaxCodeComplexity", 10) |
|
1046 Preferences.Prefs.settings.setValue("PEP8/LineComplexity", 15) |
|
1047 Preferences.Prefs.settings.setValue("PEP8/LineComplexityScore", 10) |
1020 Preferences.Prefs.settings.setValue( |
1048 Preferences.Prefs.settings.setValue( |
1021 "PEP8/ValidEncodings", "latin-1, utf-8") |
1049 "PEP8/ValidEncodings", "latin-1, utf-8") |
1022 Preferences.Prefs.settings.setValue("PEP8/CopyrightMinFileSize", 0) |
1050 Preferences.Prefs.settings.setValue("PEP8/CopyrightMinFileSize", 0) |
1023 Preferences.Prefs.settings.setValue("PEP8/CopyrightAuthor", "") |
1051 Preferences.Prefs.settings.setValue("PEP8/CopyrightAuthor", "") |
1024 Preferences.Prefs.settings.setValue("PEP8/FutureChecker", "") |
1052 Preferences.Prefs.settings.setValue("PEP8/FutureChecker", "") |