eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7980
2c3f14a3c595
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7849
diff changeset
3 # Copyright (c) 2011 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
2980
2cb4e3c50b37 Continued changing the names of the various code style checkers to make them more appropriate to the broadened scope.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2979
diff changeset
7 Module implementing a dialog to show the results of the code style check.
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import os
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import fnmatch
7980
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
12 import copy
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
14 from PyQt5.QtCore import pyqtSlot, Qt, QTimer, QCoreApplication
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3621
diff changeset
15 from PyQt5.QtGui import QIcon
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
16 from PyQt5.QtWidgets import (
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
17 QDialog, QTreeWidgetItem, QAbstractButton, QDialogButtonBox, QApplication,
7978
1e391f977124 CodeStyleCheckerDialog: added configuration entry for commented code whitelist patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
18 QHeaderView, QListWidgetItem, QInputDialog, QLineEdit
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
19 )
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 from E5Gui.E5Application import e5App
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
2973
284c7f4bc875 Continued changing the names of the various code style checkers to make them more appropriate to the broadened scope.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2972
diff changeset
23 from .Ui_CodeStyleCheckerDialog import Ui_CodeStyleCheckerDialog
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 import UI.PixmapCache
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 import Preferences
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 import Utilities
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
5147
d39dd5cee0c8 Renamed pep8.py to pycodestyle.py in order to track the upstream renaming.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
29 from . import pycodestyle
2863
62171fa4a6a4 Removed some obsolete code and corrected a PEP8 issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2862
diff changeset
30
7980
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
31 from .Miscellaneous.MiscellaneousDefaults import (
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
32 MiscellaneousCheckerDefaultArgs
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
33 )
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
34
4556
25d1fa006bf0 Process noqa under Python2.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4514
diff changeset
35 try:
4563
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4556
diff changeset
36 basestring # __IGNORE_WARNING__
881340f4bd0c Fixed a few coding style issue related to 'blind except:' statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4556
diff changeset
37 except Exception:
4556
25d1fa006bf0 Process noqa under Python2.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4514
diff changeset
38 basestring = str # define for Python3
25d1fa006bf0 Process noqa under Python2.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4514
diff changeset
39
2863
62171fa4a6a4 Removed some obsolete code and corrected a PEP8 issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2862
diff changeset
40
2973
284c7f4bc875 Continued changing the names of the various code style checkers to make them more appropriate to the broadened scope.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2972
diff changeset
41 class CodeStyleCheckerDialog(QDialog, Ui_CodeStyleCheckerDialog):
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 """
2980
2cb4e3c50b37 Continued changing the names of the various code style checkers to make them more appropriate to the broadened scope.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2979
diff changeset
43 Class implementing a dialog to show the results of the code style check.
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 filenameRole = Qt.UserRole + 1
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
46 lineRole = Qt.UserRole + 2
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 positionRole = Qt.UserRole + 3
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
48 messageRole = Qt.UserRole + 4
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
49 fixableRole = Qt.UserRole + 5
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
50 codeRole = Qt.UserRole + 6
3489
9c5af34205c9 Improved the code style checker to show statistics about ignored issues and to show ignored issues in the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
51 ignoredRole = Qt.UserRole + 7
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
52 argsRole = Qt.UserRole + 8
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
4509
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
54 availableFutures = [
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
55 'division', 'absolute_import', 'with_statement',
7600
d2bf0476484b CodeStyleCheckerDialog: changed the dialog layout to get more space for the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
56 'print_function', 'unicode_literals', 'generator_stop',
d2bf0476484b CodeStyleCheckerDialog: changed the dialog layout to get more space for the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
57 'annotations']
4509
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
58
7619
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
59 cryptoBitSelectionsDsaRsa = [
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
60 "512", "1024", "2048", "4096", "8192", "16384", "32786",
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
61 ]
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
62 cryptoBitSelectionsEc = [
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
63 "160", "224", "256", "384", "512",
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
64 ]
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
65
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
66 checkCategories = {
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
67 "A": QCoreApplication.translate(
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
68 "CheckerCategories",
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
69 "Annotations"),
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
70 "C": QCoreApplication.translate(
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
71 "CheckerCategories",
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
72 "Code Complexity"),
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
73 "D": QCoreApplication.translate(
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
74 "CheckerCategories",
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
75 "Documentation"),
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
76 "E": QCoreApplication.translate(
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
77 "CheckerCategories",
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
78 "Errors"),
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
79 "M": QCoreApplication.translate(
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
80 "CheckerCategories",
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
81 "Miscellaneous"),
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
82 "N": QCoreApplication.translate(
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
83 "CheckerCategories",
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
84 "Naming"),
7611
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
85 "S": QCoreApplication.translate(
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
86 "CheckerCategories",
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
87 "Security"),
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
88 "W": QCoreApplication.translate(
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
89 "CheckerCategories",
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
90 "Warnings"),
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
91 }
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
92
5290
174dae2b91c3 Reverted the change to pycodestyle related to E705 and changed the globl constants in CodeStyleCheckerDialog.py to class variables (constants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5289
diff changeset
93 noResults = 0
174dae2b91c3 Reverted the change to pycodestyle related to E705 and changed the globl constants in CodeStyleCheckerDialog.py to class variables (constants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5289
diff changeset
94 noFiles = 1
174dae2b91c3 Reverted the change to pycodestyle related to E705 and changed the globl constants in CodeStyleCheckerDialog.py to class variables (constants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5289
diff changeset
95 hasResults = 2
174dae2b91c3 Reverted the change to pycodestyle related to E705 and changed the globl constants in CodeStyleCheckerDialog.py to class variables (constants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5289
diff changeset
96
7632
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
97 def __init__(self, styleCheckService, project=None, parent=None):
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 Constructor
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100
3413
5e63f809732a Code style checker: Translations extracted and refactored.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3228
diff changeset
101 @param styleCheckService reference to the service
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
102 @type CodeStyleCheckService
7632
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
103 @param project reference to the project if called on project or project
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
104 browser level
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
105 @type Project
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
106 @param parent reference to the parent widget
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
107 @type QWidget
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 """
3057
10516539f238 Merge with default branch after shorten the code lines to max. 79 characters.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3056 3004
diff changeset
109 super(CodeStyleCheckerDialog, self).__init__(parent)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 self.setupUi(self)
4278
ccd1e13cb9bd Fixed issues where dialogs could not be minimized on some desktop environments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4236
diff changeset
111 self.setWindowFlags(Qt.Window)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112
7632
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
113 self.__project = project
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
114
5661
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
115 self.optionsTabWidget.setCurrentIndex(0)
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
116
3186
a05eff845522 Changed all the file or directory selection buttons to QToolButton and gave them an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3175
diff changeset
117 self.excludeMessagesSelectButton.setIcon(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
118 UI.PixmapCache.getIcon("select"))
3186
a05eff845522 Changed all the file or directory selection buttons to QToolButton and gave them an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3175
diff changeset
119 self.includeMessagesSelectButton.setIcon(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
120 UI.PixmapCache.getIcon("select"))
3186
a05eff845522 Changed all the file or directory selection buttons to QToolButton and gave them an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3175
diff changeset
121 self.fixIssuesSelectButton.setIcon(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
122 UI.PixmapCache.getIcon("select"))
3186
a05eff845522 Changed all the file or directory selection buttons to QToolButton and gave them an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3175
diff changeset
123 self.noFixIssuesSelectButton.setIcon(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
124 UI.PixmapCache.getIcon("select"))
3186
a05eff845522 Changed all the file or directory selection buttons to QToolButton and gave them an icon.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3175
diff changeset
125
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
126 self.docTypeComboBox.addItem(self.tr("PEP-257"), "pep257")
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3186
diff changeset
127 self.docTypeComboBox.addItem(self.tr("Eric"), "eric")
2928
4f74d3f595ce Started enhancing the docstring checker to include the eric docstring style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2920
diff changeset
128
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
129 for category, text in CodeStyleCheckerDialog.checkCategories.items():
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
130 itm = QListWidgetItem(text, self.categoriesList)
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
131 itm.setData(Qt.UserRole, category)
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
132 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable)
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
133 itm.setCheckState(Qt.Unchecked)
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
134
5636
709a306baa81 Changed some lists of the style checker to contain checkable items.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5625
diff changeset
135 for future in CodeStyleCheckerDialog.availableFutures:
709a306baa81 Changed some lists of the style checker to contain checkable items.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5625
diff changeset
136 itm = QListWidgetItem(future, self.futuresList)
709a306baa81 Changed some lists of the style checker to contain checkable items.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5625
diff changeset
137 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable)
709a306baa81 Changed some lists of the style checker to contain checkable items.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5625
diff changeset
138 itm.setCheckState(Qt.Unchecked)
4509
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
139
7619
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
140 self.dsaHighRiskCombo.addItems(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
141 CodeStyleCheckerDialog.cryptoBitSelectionsDsaRsa)
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
142 self.dsaMediumRiskCombo.addItems(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
143 CodeStyleCheckerDialog.cryptoBitSelectionsDsaRsa)
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
144 self.rsaHighRiskCombo.addItems(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
145 CodeStyleCheckerDialog.cryptoBitSelectionsDsaRsa)
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
146 self.rsaMediumRiskCombo.addItems(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
147 CodeStyleCheckerDialog.cryptoBitSelectionsDsaRsa)
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
148 self.ecHighRiskCombo.addItems(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
149 CodeStyleCheckerDialog.cryptoBitSelectionsEc)
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
150 self.ecMediumRiskCombo.addItems(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
151 CodeStyleCheckerDialog.cryptoBitSelectionsEc)
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
152
847
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
153 self.statisticsButton.setEnabled(False)
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
154 self.showButton.setEnabled(False)
7631
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
155 self.cancelButton.setEnabled(True)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 self.resultList.headerItem().setText(self.resultList.columnCount(), "")
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 self.resultList.header().setSortIndicator(0, Qt.AscendingOrder)
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
161 self.addBuiltinButton.setIcon(UI.PixmapCache.getIcon("plus"))
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
162 self.deleteBuiltinButton.setIcon(UI.PixmapCache.getIcon("minus"))
7980
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
163 self.addWhitelistButton.setIcon(UI.PixmapCache.getIcon("plus"))
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
164 self.deleteWhitelistButton.setIcon(UI.PixmapCache.getIcon("minus"))
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
165
7600
d2bf0476484b CodeStyleCheckerDialog: changed the dialog layout to get more space for the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
166 self.restartButton.setEnabled(False)
d2bf0476484b CodeStyleCheckerDialog: changed the dialog layout to get more space for the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
167 self.fixButton.setEnabled(False)
d2bf0476484b CodeStyleCheckerDialog: changed the dialog layout to get more space for the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
168
2947
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
169 self.checkProgress.setVisible(False)
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
170 self.checkProgressLabel.setVisible(False)
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
171 self.checkProgressLabel.setMaximumWidth(600)
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
172
3413
5e63f809732a Code style checker: Translations extracted and refactored.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3228
diff changeset
173 self.styleCheckService = styleCheckService
5e63f809732a Code style checker: Translations extracted and refactored.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3228
diff changeset
174 self.styleCheckService.styleChecked.connect(self.__processResult)
4218
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
175 self.styleCheckService.batchFinished.connect(self.__batchFinished)
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
176 self.styleCheckService.error.connect(self.__processError)
3413
5e63f809732a Code style checker: Translations extracted and refactored.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3228
diff changeset
177 self.filename = None
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
178
5290
174dae2b91c3 Reverted the change to pycodestyle related to E705 and changed the globl constants in CodeStyleCheckerDialog.py to class variables (constants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5289
diff changeset
179 self.results = CodeStyleCheckerDialog.noResults
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 self.cancelled = False
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 self.__lastFileItem = None
5289
26e4a082ba54 Avoid exception and be able to close the code style dialog if no file found because of filter settings.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5147
diff changeset
182 self.__batch = False
4218
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
183 self.__finished = True
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
184 self.__errorItem = None
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 self.__fileOrFileList = ""
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 self.__project = None
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 self.__forProject = False
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 self.__data = {}
847
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
190 self.__statistics = {}
3746
0c1d19eb0ac6 Wrong behavior if more than one file for code style fixes selected fixed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3656
diff changeset
191 self.__onlyFixes = {}
4437
b9cc331a4576 Some little fixes to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4434
diff changeset
192 self.__noFixCodesList = []
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 self.on_loadDefaultButton_clicked()
7600
d2bf0476484b CodeStyleCheckerDialog: changed the dialog layout to get more space for the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
195
d2bf0476484b CodeStyleCheckerDialog: changed the dialog layout to get more space for the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
196 self.mainWidget.setCurrentWidget(self.configureTab)
d2bf0476484b CodeStyleCheckerDialog: changed the dialog layout to get more space for the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
197 self.optionsTabWidget.setCurrentWidget(self.globalOptionsTab)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 def __resort(self):
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 Private method to resort the tree.
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
203 self.resultList.sortItems(self.resultList.sortColumn(),
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 self.resultList.header().sortIndicatorOrder()
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
205 )
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
207 def __createErrorItem(self, filename, message):
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
208 """
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
209 Private slot to create a new error item in the result list.
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
210
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
211 @param filename name of the file
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
212 @type str
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
213 @param message error message
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
214 @type str
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
215 """
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
216 if self.__errorItem is None:
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
217 self.__errorItem = QTreeWidgetItem(self.resultList, [
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
218 self.tr("Errors")])
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
219 self.__errorItem.setExpanded(True)
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
220 self.__errorItem.setForeground(0, Qt.red)
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
221
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
222 msg = "{0} ({1})".format(self.__project.getRelativePath(filename),
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
223 message)
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
224 if not self.resultList.findItems(msg, Qt.MatchExactly):
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
225 itm = QTreeWidgetItem(self.__errorItem, [msg])
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
226 itm.setForeground(0, Qt.red)
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
227 itm.setFirstColumnSpanned(True)
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
228
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
229 def __createFileErrorItem(self, filename, message):
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
230 """
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
231 Private method to create an error entry for a given file.
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
232
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
233 @param filename file name of the file
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
234 @type str
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
235 @param message error message text
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
236 @type str
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
237 """
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
238 result = {
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
239 "file": filename,
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
240 "line": 1,
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
241 "offset": 1,
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
242 "code": "",
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
243 "args": [],
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
244 "display": self.tr("Error: {0}").format(message).rstrip(),
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
245 "fixed": False,
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
246 "autofixing": False,
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
247 "ignored": False,
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
248 }
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
249 self.__createResultItem(filename, result)
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
250
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
251 def __createResultItem(self, filename, result):
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 Private method to create an entry in the result list.
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
255 @param filename file name of the file
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
256 @type str
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
257 @param result dictionary containing check result data
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
258 @type dict
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
259 @return reference to the created item
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
260 @rtype QTreeWidgetItem
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 """
2978
9d63132a23e0 Continued changing the names of the various code style checkers to make them more appropriate to the broadened scope.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2973
diff changeset
262 from .CodeStyleFixer import FixableCodeStyleIssues
2404
cba0ff902c2b Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
263
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 if self.__lastFileItem is None:
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 # It's a new file
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
266 self.__lastFileItem = QTreeWidgetItem(self.resultList, [
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
267 self.__project.getRelativePath(filename)])
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 self.__lastFileItem.setFirstColumnSpanned(True)
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 self.__lastFileItem.setExpanded(True)
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
270 self.__lastFileItem.setData(0, self.filenameRole, filename)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
272 msgCode = result["code"].split(".", 1)[0]
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
273
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
274 fixable = False
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3004
diff changeset
275 itm = QTreeWidgetItem(
7614
646742c260bd Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7611
diff changeset
276 self.__lastFileItem, [
646742c260bd Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7611
diff changeset
277 "{0:6}".format(result["line"]),
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
278 msgCode,
7614
646742c260bd Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7611
diff changeset
279 result["display"]
646742c260bd Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7611
diff changeset
280 ]
646742c260bd Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7611
diff changeset
281 )
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
282 if msgCode.startswith(("W", "-", "C", "M")):
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
283 itm.setIcon(1, UI.PixmapCache.getIcon("warning"))
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
284 elif msgCode.startswith(("A", "N")):
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
285 itm.setIcon(1, UI.PixmapCache.getIcon("namingError"))
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
286 elif msgCode.startswith("D"):
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
287 itm.setIcon(1, UI.PixmapCache.getIcon("docstringError"))
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
288 elif msgCode.startswith("S"):
7611
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
289 if "severity" in result:
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
290 if result["severity"] == "H":
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
291 itm.setIcon(1, UI.PixmapCache.getIcon("securityLow"))
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
292 elif result["severity"] == "M":
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
293 itm.setIcon(1, UI.PixmapCache.getIcon("securityMedium"))
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
294 elif result["severity"] == "L":
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
295 itm.setIcon(1, UI.PixmapCache.getIcon("securityHigh"))
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
296 else:
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
297 itm.setIcon(1, UI.PixmapCache.getIcon("securityLow"))
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
298 else:
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
299 itm.setIcon(1, UI.PixmapCache.getIcon("securityLow"))
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 else:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
301 itm.setIcon(1, UI.PixmapCache.getIcon("syntaxError"))
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
302 if result["fixed"]:
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
303 itm.setIcon(0, UI.PixmapCache.getIcon("issueFixed"))
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
304 elif (
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
305 msgCode in FixableCodeStyleIssues and
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
306 not result["autofixing"] and
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
307 msgCode not in self.__noFixCodesList
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
308 ):
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
309 itm.setIcon(0, UI.PixmapCache.getIcon("issueFixable"))
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
310 fixable = True
847
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
311
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
312 itm.setTextAlignment(0, Qt.AlignRight)
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
313 itm.setTextAlignment(1, Qt.AlignHCenter)
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
314
853
ec7dd115e26b Continued implementing a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 849
diff changeset
315 itm.setTextAlignment(0, Qt.AlignVCenter)
ec7dd115e26b Continued implementing a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 849
diff changeset
316 itm.setTextAlignment(1, Qt.AlignVCenter)
ec7dd115e26b Continued implementing a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 849
diff changeset
317 itm.setTextAlignment(2, Qt.AlignVCenter)
ec7dd115e26b Continued implementing a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 849
diff changeset
318
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
319 itm.setData(0, self.filenameRole, filename)
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
320 itm.setData(0, self.lineRole, int(result["line"]))
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
321 itm.setData(0, self.positionRole, int(result["offset"]))
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
322 itm.setData(0, self.messageRole, result["display"])
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
323 itm.setData(0, self.fixableRole, fixable)
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
324 itm.setData(0, self.codeRole, msgCode)
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
325 itm.setData(0, self.ignoredRole, result["ignored"])
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
326 itm.setData(0, self.argsRole, result["args"])
3489
9c5af34205c9 Improved the code style checker to show statistics about ignored issues and to show ignored issues in the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
327
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
328 if result["ignored"]:
3489
9c5af34205c9 Improved the code style checker to show statistics about ignored issues and to show ignored issues in the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
329 font = itm.font(0)
9c5af34205c9 Improved the code style checker to show statistics about ignored issues and to show ignored issues in the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
330 font.setItalic(True)
9c5af34205c9 Improved the code style checker to show statistics about ignored issues and to show ignored issues in the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
331 for col in range(itm.columnCount()):
9c5af34205c9 Improved the code style checker to show statistics about ignored issues and to show ignored issues in the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
332 itm.setFont(col, font)
2891
6843b7d23279 Changed the PEP-8 fixer and dialog to decouple the indication of the fixed status from the generation of the PEP-8 status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2890
diff changeset
333
6843b7d23279 Changed the PEP-8 fixer and dialog to decouple the indication of the fixed status from the generation of the PEP-8 status.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2890
diff changeset
334 return itm
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
335
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
336 def __modifyFixedResultItem(self, itm, result):
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
337 """
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
338 Private method to modify a result list entry to show its
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
339 positive fixed state.
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
340
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
341 @param itm reference to the item to modify
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
342 @type QTreeWidgetItem
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
343 @param result dictionary containing check result data
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
344 @type dict
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
345 """
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
346 if result["fixed"]:
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
347 itm.setText(2, result["display"])
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
348 itm.setIcon(0, UI.PixmapCache.getIcon("issueFixed"))
2890
86b03a0c94bc Started modifying PEP-8 dialog to change fixable state if a fixable issue could not be fixed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2881
diff changeset
349
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
350 itm.setData(0, self.messageRole, result["display"])
2890
86b03a0c94bc Started modifying PEP-8 dialog to change fixable state if a fixable issue could not be fixed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2881
diff changeset
351 else:
86b03a0c94bc Started modifying PEP-8 dialog to change fixable state if a fixable issue could not be fixed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2881
diff changeset
352 itm.setIcon(0, QIcon())
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
353 itm.setData(0, self.fixableRole, False)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
355 def __updateStatistics(self, statistics, fixer, ignoredErrors, securityOk):
847
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
356 """
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
357 Private method to update the collected statistics.
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
358
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
359 @param statistics dictionary of statistical data with
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
360 message code as key and message count as value
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
361 @type dict
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
362 @param fixer reference to the code style fixer
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
363 @type CodeStyleFixer
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
364 @param ignoredErrors number of ignored errors
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
365 @type int
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
366 @param securityOk number of acknowledged security reports
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
367 @type int
847
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
368 """
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
369 self.__statistics["_FilesCount"] += 1
3056
9986ec0e559a Merge with default branch before style changes.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2911 2947
diff changeset
370 stats = [k for k in statistics.keys() if k[0].isupper()]
2914
6b30a602e404 Fixed an issue in the code style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2905
diff changeset
371 if stats:
847
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
372 self.__statistics["_FilesIssues"] += 1
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
373 for key in statistics:
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
374 if key in self.__statistics:
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
375 self.__statistics[key] += statistics[key]
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
376 else:
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
377 self.__statistics[key] = statistics[key]
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
378 self.__statistics["_IssuesFixed"] += fixer
3489
9c5af34205c9 Improved the code style checker to show statistics about ignored issues and to show ignored issues in the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
379 self.__statistics["_IgnoredErrors"] += ignoredErrors
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
380 self.__statistics["_SecurityOK"] += securityOk
847
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
381
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
382 def __updateFixerStatistics(self, fixer):
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
383 """
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
384 Private method to update the collected fixer related statistics.
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
385
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
386 @param fixer reference to the code style fixer
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
387 @type CodeStyleFixer
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
388 """
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
389 self.__statistics["_IssuesFixed"] += fixer
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
390
847
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
391 def __resetStatistics(self):
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
392 """
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
393 Private slot to reset the statistics data.
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
394 """
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
395 self.__statistics = {}
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
396 self.__statistics["_FilesCount"] = 0
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
397 self.__statistics["_FilesIssues"] = 0
853
ec7dd115e26b Continued implementing a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 849
diff changeset
398 self.__statistics["_IssuesFixed"] = 0
3489
9c5af34205c9 Improved the code style checker to show statistics about ignored issues and to show ignored issues in the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
399 self.__statistics["_IgnoredErrors"] = 0
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
400 self.__statistics["_SecurityOK"] = 0
847
cc18fbcde9fc Added a dialog to show some statistics for the last PEP 8 check to the PEP 8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 843
diff changeset
401
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 def prepare(self, fileList, project):
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 Public method to prepare the dialog with a list of filenames.
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
406 @param fileList list of filenames
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
407 @type list of str
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
408 @param project reference to the project object
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
409 @type Project
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 self.__fileOrFileList = fileList[:]
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 self.__project = project
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 self.__forProject = True
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
7631
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
417 self.cancelButton.setEnabled(False)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 self.__data = self.__project.getData("CHECKERSPARMS", "Pep8Checker")
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
420 if (
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
421 self.__data is None or
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
422 len(self.__data) < 6
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
423 ):
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424 # initialize the data structure
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 self.__data = {
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
426 "ExcludeFiles": "",
5147
d39dd5cee0c8 Renamed pep8.py to pycodestyle.py in order to track the upstream renaming.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
427 "ExcludeMessages": pycodestyle.DEFAULT_IGNORE,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
428 "IncludeMessages": "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
429 "RepeatMessages": False,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
430 "FixCodes": "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
431 "FixIssues": False,
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 }
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
433 if "EnabledCheckerCategories" not in self.__data:
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
434 self.__data["EnabledCheckerCategories"] = ",".join(
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
435 CodeStyleCheckerDialog.checkCategories.keys())
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
436 if "MaxLineLength" not in self.__data:
5147
d39dd5cee0c8 Renamed pep8.py to pycodestyle.py in order to track the upstream renaming.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
437 self.__data["MaxLineLength"] = pycodestyle.MAX_LINE_LENGTH
6786
701b511ba8f5 Added option to set the documentation line length.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6645
diff changeset
438 if "MaxDocLineLength" not in self.__data:
701b511ba8f5 Added option to set the documentation line length.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6645
diff changeset
439 # Use MAX_LINE_LENGTH to avoid messages on existing code
701b511ba8f5 Added option to set the documentation line length.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6645
diff changeset
440 self.__data["MaxDocLineLength"] = pycodestyle.MAX_LINE_LENGTH
6264
04a671fa4adb code style checker: extended the dialog to be able to define the number of blank lines before class and function/method definitions
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6188
diff changeset
441 if "BlankLines" not in self.__data:
04a671fa4adb code style checker: extended the dialog to be able to define the number of blank lines before class and function/method definitions
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6188
diff changeset
442 self.__data["BlankLines"] = (2, 1)
04a671fa4adb code style checker: extended the dialog to be able to define the number of blank lines before class and function/method definitions
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6188
diff changeset
443 # top level, method
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
444 if "HangClosing" not in self.__data:
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
445 self.__data["HangClosing"] = False
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
446 if "NoFixCodes" not in self.__data:
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
447 self.__data["NoFixCodes"] = "E501"
2928
4f74d3f595ce Started enhancing the docstring checker to include the eric docstring style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2920
diff changeset
448 if "DocstringType" not in self.__data:
4f74d3f595ce Started enhancing the docstring checker to include the eric docstring style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2920
diff changeset
449 self.__data["DocstringType"] = "pep257"
3489
9c5af34205c9 Improved the code style checker to show statistics about ignored issues and to show ignored issues in the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
450 if "ShowIgnored" not in self.__data:
9c5af34205c9 Improved the code style checker to show statistics about ignored issues and to show ignored issues in the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
451 self.__data["ShowIgnored"] = False
4423
14f3ca3dcef6 Added a code complexity checker iaw. McCabe to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4278
diff changeset
452 if "MaxCodeComplexity" not in self.__data:
14f3ca3dcef6 Added a code complexity checker iaw. McCabe to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4278
diff changeset
453 self.__data["MaxCodeComplexity"] = 10
5661
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
454 if "LineComplexity" not in self.__data:
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
455 self.__data["LineComplexity"] = 15
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
456 if "LineComplexityScore" not in self.__data:
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
457 self.__data["LineComplexityScore"] = 10
4506
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
458 if "ValidEncodings" not in self.__data:
7980
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
459 self.__data["ValidEncodings"] = (
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
460 MiscellaneousCheckerDefaultArgs["CodingChecker"]
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
461 )
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
462 if (
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
463 "CopyrightMinFileSize" not in self.__data or
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
464 "CopyrightAuthor" not in self.__data
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
465 ):
7980
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
466 self.__data["CopyrightMinFileSize"] = (
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
467 MiscellaneousCheckerDefaultArgs[
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
468 "CopyrightChecker"]["MinFilesize"]
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
469 )
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
470 self.__data["CopyrightAuthor"] = (
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
471 MiscellaneousCheckerDefaultArgs["CopyrightChecker"]["Author"]
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
472 )
4509
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
473 if "FutureChecker" not in self.__data:
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
474 self.__data["FutureChecker"] = ""
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
475 if "BuiltinsChecker" not in self.__data:
7980
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
476 self.__data["BuiltinsChecker"] = copy.deepcopy(
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
477 MiscellaneousCheckerDefaultArgs["BuiltinsChecker"]
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
478 )
7978
1e391f977124 CodeStyleCheckerDialog: added configuration entry for commented code whitelist patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
479
7040
f89952e5fc11 Code Style Checker: added check for commented code that should be removed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
480 if "CommentedCodeChecker" not in self.__data:
7980
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
481 self.__data["CommentedCodeChecker"] = copy.deepcopy(
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
482 MiscellaneousCheckerDefaultArgs["CommentedCodeChecker"]
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
483 )
7978
1e391f977124 CodeStyleCheckerDialog: added configuration entry for commented code whitelist patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
484 if "WhiteList" not in self.__data["CommentedCodeChecker"]:
7980
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
485 self.__data["CommentedCodeChecker"]["WhiteList"] = (
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
486 MiscellaneousCheckerDefaultArgs[
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
487 "CommentedCodeChecker"]["WhiteList"][:]
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
488 )
7978
1e391f977124 CodeStyleCheckerDialog: added configuration entry for commented code whitelist patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
489
7247
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
490 if "AnnotationsChecker" not in self.__data:
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
491 self.__data["AnnotationsChecker"] = {
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
492 "MinimumCoverage": 75,
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
493 "MaximumComplexity": 3,
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
494 }
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
495
7619
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
496 if "SecurityChecker" not in self.__data:
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
497 from .Security.SecurityDefaults import SecurityDefaults
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
498 self.__data["SecurityChecker"] = {
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
499 "HardcodedTmpDirectories":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
500 SecurityDefaults["hardcoded_tmp_directories"],
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
501 "InsecureHashes":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
502 SecurityDefaults["insecure_hashes"],
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
503 "InsecureSslProtocolVersions":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
504 SecurityDefaults["insecure_ssl_protocol_versions"],
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
505 "WeakKeySizeDsaHigh":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
506 str(SecurityDefaults["weak_key_size_dsa_high"]),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
507 "WeakKeySizeDsaMedium":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
508 str(SecurityDefaults["weak_key_size_dsa_medium"]),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
509 "WeakKeySizeRsaHigh":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
510 str(SecurityDefaults["weak_key_size_rsa_high"]),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
511 "WeakKeySizeRsaMedium":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
512 str(SecurityDefaults["weak_key_size_rsa_medium"]),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
513 "WeakKeySizeEcHigh":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
514 str(SecurityDefaults["weak_key_size_ec_high"]),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
515 "WeakKeySizeEcMedium":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
516 str(SecurityDefaults["weak_key_size_ec_medium"]),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
517 "CheckTypedException":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
518 SecurityDefaults["check_typed_exception"],
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
519 }
7614
646742c260bd Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7611
diff changeset
520
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
521 self.__initCategoriesList(self.__data["EnabledCheckerCategories"])
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 self.excludeFilesEdit.setText(self.__data["ExcludeFiles"])
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 self.excludeMessagesEdit.setText(self.__data["ExcludeMessages"])
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 self.includeMessagesEdit.setText(self.__data["IncludeMessages"])
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 self.repeatCheckBox.setChecked(self.__data["RepeatMessages"])
849
996367a89673 Started to implement a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 847
diff changeset
526 self.fixIssuesEdit.setText(self.__data["FixCodes"])
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
527 self.noFixIssuesEdit.setText(self.__data["NoFixCodes"])
849
996367a89673 Started to implement a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 847
diff changeset
528 self.fixIssuesCheckBox.setChecked(self.__data["FixIssues"])
3489
9c5af34205c9 Improved the code style checker to show statistics about ignored issues and to show ignored issues in the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
529 self.ignoredCheckBox.setChecked(self.__data["ShowIgnored"])
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
530 self.lineLengthSpinBox.setValue(self.__data["MaxLineLength"])
6786
701b511ba8f5 Added option to set the documentation line length.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6645
diff changeset
531 self.docLineLengthSpinBox.setValue(self.__data["MaxDocLineLength"])
6264
04a671fa4adb code style checker: extended the dialog to be able to define the number of blank lines before class and function/method definitions
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6188
diff changeset
532 self.blankBeforeTopLevelSpinBox.setValue(self.__data["BlankLines"][0])
04a671fa4adb code style checker: extended the dialog to be able to define the number of blank lines before class and function/method definitions
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6188
diff changeset
533 self.blankBeforeMethodSpinBox.setValue(self.__data["BlankLines"][1])
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
534 self.hangClosingCheckBox.setChecked(self.__data["HangClosing"])
2928
4f74d3f595ce Started enhancing the docstring checker to include the eric docstring style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2920
diff changeset
535 self.docTypeComboBox.setCurrentIndex(
4f74d3f595ce Started enhancing the docstring checker to include the eric docstring style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2920
diff changeset
536 self.docTypeComboBox.findData(self.__data["DocstringType"]))
4423
14f3ca3dcef6 Added a code complexity checker iaw. McCabe to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4278
diff changeset
537 self.complexitySpinBox.setValue(self.__data["MaxCodeComplexity"])
5661
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
538 self.lineComplexitySpinBox.setValue(self.__data["LineComplexity"])
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
539 self.lineComplexityScoreSpinBox.setValue(
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
540 self.__data["LineComplexityScore"])
4506
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
541 self.encodingsEdit.setText(self.__data["ValidEncodings"])
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
542 self.copyrightFileSizeSpinBox.setValue(
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
543 self.__data["CopyrightMinFileSize"])
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
544 self.copyrightAuthorEdit.setText(self.__data["CopyrightAuthor"])
4509
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
545 self.__initFuturesList(self.__data["FutureChecker"])
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
546 self.__initBuiltinsIgnoreList(self.__data["BuiltinsChecker"])
7040
f89952e5fc11 Code Style Checker: added check for commented code that should be removed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
547 self.aggressiveCheckBox.setChecked(
f89952e5fc11 Code Style Checker: added check for commented code that should be removed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
548 self.__data["CommentedCodeChecker"]["Aggressive"])
7978
1e391f977124 CodeStyleCheckerDialog: added configuration entry for commented code whitelist patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
549 self.__initCommentedCodeCheckerWhiteList(
1e391f977124 CodeStyleCheckerDialog: added configuration entry for commented code whitelist patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
550 self.__data["CommentedCodeChecker"]["WhiteList"])
7247
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
551 self.minAnnotationsCoverageSpinBox.setValue(
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
552 self.__data["AnnotationsChecker"]["MinimumCoverage"])
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
553 self.maxAnnotationsComplexitySpinBox.setValue(
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
554 self.__data["AnnotationsChecker"]["MaximumComplexity"])
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
555
7619
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
556 # security
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
557 self.tmpDirectoriesEdit.setPlainText("\n".join(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
558 self.__data["SecurityChecker"]["HardcodedTmpDirectories"]))
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
559 self.hashesEdit.setText(", ".join(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
560 self.__data["SecurityChecker"]["InsecureHashes"]))
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
561 self.insecureSslProtocolsEdit.setPlainText("\n".join(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
562 self.__data["SecurityChecker"]["InsecureSslProtocolVersions"]))
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
563 self.dsaHighRiskCombo.setCurrentText(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
564 self.__data["SecurityChecker"]["WeakKeySizeDsaHigh"])
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
565 self.dsaMediumRiskCombo.setCurrentText(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
566 self.__data["SecurityChecker"]["WeakKeySizeDsaMedium"])
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
567 self.rsaHighRiskCombo.setCurrentText(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
568 self.__data["SecurityChecker"]["WeakKeySizeRsaHigh"])
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
569 self.rsaMediumRiskCombo.setCurrentText(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
570 self.__data["SecurityChecker"]["WeakKeySizeRsaMedium"])
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
571 self.ecHighRiskCombo.setCurrentText(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
572 self.__data["SecurityChecker"]["WeakKeySizeEcHigh"])
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
573 self.ecMediumRiskCombo.setCurrentText(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
574 self.__data["SecurityChecker"]["WeakKeySizeEcMedium"])
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
575 self.typedExceptionsCheckBox.setChecked(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
576 self.__data["SecurityChecker"]["CheckTypedException"])
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
577
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
578 self.__cleanupData()
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579
7631
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
580 def __prepareProgress(self):
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
581 """
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
582 Private method to prepare the progress tab for the next run.
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
583 """
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
584 self.progressList.clear()
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
585 if len(self.files) > 0:
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
586 self.checkProgress.setMaximum(len(self.files))
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
587 self.checkProgressLabel.setVisible(len(self.files) > 1)
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
588 self.checkProgress.setVisible(len(self.files) > 1)
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
589 if len(self.files) > 1:
7632
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
590 if self.__project:
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
591 self.progressList.addItems([
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
592 os.path.join("...", self.__project.getRelativePath(f))
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
593 for f in self.files
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
594 ])
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
595 else:
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
596 self.progressList.addItems(self.files)
7631
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
597
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
598 QApplication.processEvents()
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
599
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
600 def start(self, fn, save=False, repeat=None):
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 """
2980
2cb4e3c50b37 Continued changing the names of the various code style checkers to make them more appropriate to the broadened scope.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2979
diff changeset
602 Public slot to start the code style check.
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
603
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
604 @param fn file or list of files or directory to be checked
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
605 @type str or list of str
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
606 @param save flag indicating to save the given file/file list/directory
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
607 @type bool
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
608 @param repeat state of the repeat check box if it is not None
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
609 @type None or bool
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
610 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611 if self.__project is None:
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 self.__project = e5App().getObject("Project")
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613
7631
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
614 self.mainWidget.setCurrentWidget(self.progressTab)
7600
d2bf0476484b CodeStyleCheckerDialog: changed the dialog layout to get more space for the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
615
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
616 self.cancelled = False
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
7631
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
618 self.cancelButton.setEnabled(True)
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
619 self.cancelButton.setDefault(True)
940
0f5461fe69d4 Implemented some speed improvements for the PEP 8 checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 853
diff changeset
620 self.statisticsButton.setEnabled(False)
0f5461fe69d4 Implemented some speed improvements for the PEP 8 checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 853
diff changeset
621 self.showButton.setEnabled(False)
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
622 self.fixButton.setEnabled(False)
2902
15a5fe0b0a09 Changed PEP-8 dialog code to disable the the start button while a check is in progress.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2895
diff changeset
623 self.startButton.setEnabled(False)
7600
d2bf0476484b CodeStyleCheckerDialog: changed the dialog layout to get more space for the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
624 self.restartButton.setEnabled(False)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 if repeat is not None:
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 self.repeatCheckBox.setChecked(repeat)
2947
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
627 self.checkProgress.setVisible(True)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 QApplication.processEvents()
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
629
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 if save:
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 self.__fileOrFileList = fn
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 if isinstance(fn, list):
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
634 self.files = fn[:]
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 elif os.path.isdir(fn):
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
636 self.files = []
7637
c878e8255972 Removed some more Python2 related code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7632
diff changeset
637 extensions = set(Preferences.getPython("Python3Extensions"))
2607
e5115553185a Fixes and consolidation for PEP8-checker.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2525
diff changeset
638 for ext in extensions:
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
639 self.files.extend(Utilities.direntries(
3065
070b35dde35e Fixed a bunch of indentation issues.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
640 fn, True, '*{0}'.format(ext), 0))
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 else:
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
642 self.files = [fn]
7631
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
643
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 # filter the list depending on the filter string
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
645 if self.files:
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 filterString = self.excludeFilesEdit.text()
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
647 filterList = [f.strip() for f in filterString.split(",")
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 if f.strip()]
5597
3d88d53f8c2b Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
649 for fileFilter in filterList:
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
650 self.files = [
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
651 f for f in self.files
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
652 if not fnmatch.fnmatch(f, fileFilter.strip())
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
653 ]
7631
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
654
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
655 self.__errorItem = None
3175
1a6638ccce9d Fixed an issue in the syntax and code style checker dialogs causing markers of open files not to be checked being cleared.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
656 self.__resetStatistics()
3456
96232974dcdb Merge with BgService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3413
diff changeset
657 self.__clearErrors(self.files)
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
658 self.__cleanupData()
7631
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
659 self.__prepareProgress()
3175
1a6638ccce9d Fixed an issue in the syntax and code style checker dialogs causing markers of open files not to be checked being cleared.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
660
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
661 if len(self.files) > 0:
7619
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
662 self.securityNoteLabel.setVisible(
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
663 "S" in self.__getCategories(True, asList=True))
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 # extract the configuration values
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
666 excludeMessages = self.__assembleExcludeMessages()
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 includeMessages = self.includeMessagesEdit.text()
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668 repeatMessages = self.repeatCheckBox.isChecked()
849
996367a89673 Started to implement a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 847
diff changeset
669 fixCodes = self.fixIssuesEdit.text()
2876
bfa39cf40277 Extended the PEP-8 dialog to select fixable issues manually (i.e. fix only the selected issues).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2874
diff changeset
670 noFixCodes = self.noFixIssuesEdit.text()
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
671 self.__noFixCodesList = [
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
672 c.strip() for c in noFixCodes.split(",") if c.strip()
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
673 ]
849
996367a89673 Started to implement a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 847
diff changeset
674 fixIssues = self.fixIssuesCheckBox.isChecked() and repeatMessages
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
675 self.showIgnored = (
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
676 self.ignoredCheckBox.isChecked() and repeatMessages
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
677 )
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
678 maxLineLength = self.lineLengthSpinBox.value()
6786
701b511ba8f5 Added option to set the documentation line length.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6645
diff changeset
679 maxDocLineLength = self.docLineLengthSpinBox.value()
6264
04a671fa4adb code style checker: extended the dialog to be able to define the number of blank lines before class and function/method definitions
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6188
diff changeset
680 blankLines = (
04a671fa4adb code style checker: extended the dialog to be able to define the number of blank lines before class and function/method definitions
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6188
diff changeset
681 self.blankBeforeTopLevelSpinBox.value(),
04a671fa4adb code style checker: extended the dialog to be able to define the number of blank lines before class and function/method definitions
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6188
diff changeset
682 self.blankBeforeMethodSpinBox.value()
04a671fa4adb code style checker: extended the dialog to be able to define the number of blank lines before class and function/method definitions
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6188
diff changeset
683 )
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
684 hangClosing = self.hangClosingCheckBox.isChecked()
2928
4f74d3f595ce Started enhancing the docstring checker to include the eric docstring style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2920
diff changeset
685 docType = self.docTypeComboBox.itemData(
4f74d3f595ce Started enhancing the docstring checker to include the eric docstring style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2920
diff changeset
686 self.docTypeComboBox.currentIndex())
5661
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
687 codeComplexityArgs = {
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
688 "McCabeComplexity": self.complexitySpinBox.value(),
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
689 "LineComplexity": self.lineComplexitySpinBox.value(),
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
690 "LineComplexityScore": self.lineComplexityScoreSpinBox.value(),
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
691 }
4506
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
692 miscellaneousArgs = {
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
693 "CodingChecker": self.encodingsEdit.text(),
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
694 "CopyrightChecker": {
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
695 "MinFilesize": self.copyrightFileSizeSpinBox.value(),
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
696 "Author": self.copyrightAuthorEdit.text(),
4509
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
697 },
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
698 "FutureChecker": self.__getSelectedFutureImports(),
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
699 "BuiltinsChecker": self.__getBuiltinsIgnoreList(),
7040
f89952e5fc11 Code Style Checker: added check for commented code that should be removed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
700 "CommentedCodeChecker": {
f89952e5fc11 Code Style Checker: added check for commented code that should be removed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
701 "Aggressive": self.aggressiveCheckBox.isChecked(),
7978
1e391f977124 CodeStyleCheckerDialog: added configuration entry for commented code whitelist patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
702 "WhiteList": self.__getCommentedCodeCheckerWhiteList(),
7040
f89952e5fc11 Code Style Checker: added check for commented code that should be removed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
703 }
4506
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
704 }
7247
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
705 annotationArgs = {
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
706 "MinimumCoverage":
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
707 self.minAnnotationsCoverageSpinBox.value(),
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
708 "MaximumComplexity":
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
709 self.maxAnnotationsComplexitySpinBox.value(),
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
710 }
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711
7619
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
712 securityArgs = {
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
713 "hardcoded_tmp_directories": [
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
714 t.strip()
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
715 for t in self.tmpDirectoriesEdit.toPlainText().splitlines()
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
716 ],
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
717 "insecure_hashes": [
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
718 h.strip()
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
719 for h in self.hashesEdit.text().split(",")
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
720 ],
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
721 "insecure_ssl_protocol_versions": [
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
722 p.strip()
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
723 for p in self.insecureSslProtocolsEdit.toPlainText()
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
724 .splitlines()
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
725 ],
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
726 "weak_key_size_dsa_high":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
727 int(self.dsaHighRiskCombo.currentText()),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
728 "weak_key_size_dsa_medium":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
729 int(self.dsaMediumRiskCombo.currentText()),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
730 "weak_key_size_rsa_high":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
731 int(self.rsaHighRiskCombo.currentText()),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
732 "weak_key_size_rsa_medium":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
733 int(self.rsaMediumRiskCombo.currentText()),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
734 "weak_key_size_ec_high":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
735 int(self.ecHighRiskCombo.currentText()),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
736 "weak_key_size_ec_medium":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
737 int(self.ecMediumRiskCombo.currentText()),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
738 "check_typed_exception":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
739 self.typedExceptionsCheckBox.isChecked(),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
740 }
7611
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
741
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
742 self.__options = [excludeMessages, includeMessages, repeatMessages,
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
743 fixCodes, noFixCodes, fixIssues, maxLineLength,
6786
701b511ba8f5 Added option to set the documentation line length.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6645
diff changeset
744 maxDocLineLength, blankLines, hangClosing,
7247
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
745 docType, codeComplexityArgs, miscellaneousArgs,
7619
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
746 annotationArgs, securityArgs]
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
747
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
748 # now go through all the files
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
749 self.progress = 0
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
750 self.files.sort()
4218
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
751 if len(self.files) == 1:
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
752 self.__batch = False
7631
2c7ccb4484bf Code Style Checker: extended the dialog to show a list of files still to be checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7619
diff changeset
753 self.mainWidget.setCurrentWidget(self.resultsTab)
4218
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
754 self.check()
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
755 else:
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
756 self.__batch = True
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
757 self.checkBatch()
5289
26e4a082ba54 Avoid exception and be able to close the code style dialog if no file found because of filter settings.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5147
diff changeset
758 else:
5290
174dae2b91c3 Reverted the change to pycodestyle related to E705 and changed the globl constants in CodeStyleCheckerDialog.py to class variables (constants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5289
diff changeset
759 self.results = CodeStyleCheckerDialog.noFiles
5289
26e4a082ba54 Avoid exception and be able to close the code style dialog if no file found because of filter settings.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5147
diff changeset
760 self.__finished = False
26e4a082ba54 Avoid exception and be able to close the code style dialog if no file found because of filter settings.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 5147
diff changeset
761 self.__finish()
4514
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
762
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
763 def __modifyOptions(self, source):
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
764 """
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
765 Private method to modify the options based on eflag: entries.
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
766
4514
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
767 This method looks for comment lines like '# eflag: noqa = M601'
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
768 at the end of the source in order to extend the list of excluded
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
769 messages for one file only.
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
770
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
771 @param source source text
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
772 @type list of str or str
4514
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
773 @return list of checker options
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
774 @rtype list
4514
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
775 """
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
776 options = self.__options[:]
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
777 flags = Utilities.extractFlags(source)
4556
25d1fa006bf0 Process noqa under Python2.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4514
diff changeset
778 if "noqa" in flags and isinstance(flags["noqa"], basestring):
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
779 excludeMessages = options[0].strip().rstrip(",")
4514
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
780 if excludeMessages:
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
781 excludeMessages += ","
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
782 excludeMessages += flags["noqa"]
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
783 options[0] = excludeMessages
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
784 return options
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
785
3746
0c1d19eb0ac6 Wrong behavior if more than one file for code style fixes selected fixed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3656
diff changeset
786 def check(self, codestring=''):
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
787 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3558
diff changeset
788 Public method to start a style check for one file.
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
789
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
790 The results are reported to the __processResult slot.
3558
7f2bc8910d28 Fixed issues in the various checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3549
diff changeset
791
7609
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
792 @param codestring optional sourcestring
d5aff4fd0ef8 Code Style Checker: changed the dialog to allow the selection of checker categories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7600
diff changeset
793 @type str
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
794 """
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
795 if not self.files:
2947
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
796 self.checkProgressLabel.setPath("")
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
797 self.checkProgress.setMaximum(1)
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
798 self.checkProgress.setValue(1)
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
799 self.__finish()
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
800 return
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
801
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
802 self.filename = self.files.pop(0)
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
803 self.checkProgress.setValue(self.progress)
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
804 self.checkProgressLabel.setPath(self.filename)
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
805 QApplication.processEvents()
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
806
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
807 if self.cancelled:
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
808 self.__resort()
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
809 return
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
810
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
811 self.__lastFileItem = None
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
812
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
813 if codestring:
4506
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
814 source = codestring.splitlines(True)
4217
38e8903f9c2f Fixed two little issue that could lead to a traceback in the code style checker dialog and Utilities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
815 encoding = Utilities.get_coding(source)
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
816 else:
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
817 try:
4217
38e8903f9c2f Fixed two little issue that could lead to a traceback in the code style checker dialog and Utilities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
818 source, encoding = Utilities.readEncodedFile(
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
819 self.filename)
4217
38e8903f9c2f Fixed two little issue that could lead to a traceback in the code style checker dialog and Utilities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
820 source = source.splitlines(True)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
821 except (UnicodeError, OSError) as msg:
5290
174dae2b91c3 Reverted the change to pycodestyle related to E705 and changed the globl constants in CodeStyleCheckerDialog.py to class variables (constants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5289
diff changeset
822 self.results = CodeStyleCheckerDialog.hasResults
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
823 self.__createFileErrorItem(self.filename, str(msg))
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
824 self.progress += 1
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
825 # Continue with next file
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
826 self.check()
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
827 return
4217
38e8903f9c2f Fixed two little issue that could lead to a traceback in the code style checker dialog and Utilities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
828 if encoding.endswith(
38e8903f9c2f Fixed two little issue that could lead to a traceback in the code style checker dialog and Utilities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
829 ('-selected', '-default', '-guessed', '-ignore')):
38e8903f9c2f Fixed two little issue that could lead to a traceback in the code style checker dialog and Utilities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
830 encoding = encoding.rsplit('-', 1)[0]
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
831
4514
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
832 options = self.__modifyOptions(source)
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
833
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
834 errors = []
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
835 self.__itms = []
3746
0c1d19eb0ac6 Wrong behavior if more than one file for code style fixes selected fixed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3656
diff changeset
836 for error, itm in self.__onlyFixes.pop(self.filename, []):
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
837 errors.append(error)
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
838 self.__itms.append(itm)
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
839
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
840 eol = self.__getEol(self.filename)
4514
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
841 args = options + [
3549
96ebf42cd960 Added the file backup functionality in the code style fixer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
842 errors, eol, encoding, Preferences.getEditor("CreateBackupFile")
96ebf42cd960 Added the file backup functionality in the code style fixer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
843 ]
4218
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
844 self.__finished = False
3413
5e63f809732a Code style checker: Translations extracted and refactored.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3228
diff changeset
845 self.styleCheckService.styleCheck(
4217
38e8903f9c2f Fixed two little issue that could lead to a traceback in the code style checker dialog and Utilities.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
846 None, self.filename, source, args)
4218
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
847
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
848 def checkBatch(self):
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
849 """
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
850 Public method to start a style check batch job.
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
851
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
852 The results are reported to the __processResult slot.
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
853 """
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
854 self.__lastFileItem = None
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
855
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
856 self.checkProgressLabel.setPath(self.tr("Preparing files..."))
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
857 progress = 0
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
858
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
859 argumentsList = []
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
860 for filename in self.files:
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
861 progress += 1
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
862 self.checkProgress.setValue(progress)
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
863 QApplication.processEvents()
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
864
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
865 try:
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
866 source, encoding = Utilities.readEncodedFile(
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
867 filename)
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
868 source = source.splitlines(True)
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
869 except (UnicodeError, OSError) as msg:
5290
174dae2b91c3 Reverted the change to pycodestyle related to E705 and changed the globl constants in CodeStyleCheckerDialog.py to class variables (constants).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5289
diff changeset
870 self.results = CodeStyleCheckerDialog.hasResults
7610
df7025fe26a3 Code Style Checker: reworked the API between frontend and backend to get some more flexibility for the future.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7609
diff changeset
871 self.__createFileErrorItem(filename, str(msg))
4218
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
872 continue
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
873
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
874 if encoding.endswith(
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
875 ('-selected', '-default', '-guessed', '-ignore')):
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
876 encoding = encoding.rsplit('-', 1)[0]
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
877
4514
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
878 options = self.__modifyOptions(source)
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
879
4218
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
880 errors = []
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
881 self.__itms = []
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
882 for error, itm in self.__onlyFixes.pop(filename, []):
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
883 errors.append(error)
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
884 self.__itms.append(itm)
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
885
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
886 eol = self.__getEol(filename)
4514
e410e76d6538 Added capability to disable code style checks using an eflags: comment like 'eflags: noqa = M601, M702'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4509
diff changeset
887 args = options + [
4218
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
888 errors, eol, encoding,
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
889 Preferences.getEditor("CreateBackupFile")
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
890 ]
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
891 argumentsList.append((filename, source, args))
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
892
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
893 # reset the progress bar to the checked files
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
894 self.checkProgress.setValue(self.progress)
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
895 self.checkProgressLabel.setPath(self.tr("Transferring data..."))
4218
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
896 QApplication.processEvents()
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
897
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
898 self.__finished = False
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
899 self.styleCheckService.styleBatchCheck(argumentsList)
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
900
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
901 def __batchFinished(self):
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
902 """
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
903 Private slot handling the completion of a batch job.
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
904 """
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
905 self.checkProgressLabel.setPath("")
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
906 self.checkProgress.setMaximum(1)
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
907 self.checkProgress.setValue(1)
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
908 self.__finish()
f542ad1f76c5 Added a batch mode to the code style checker to make use of multiple CPUs/CPU-Cores.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4217
diff changeset
909
4503