eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py

Tue, 02 Mar 2021 17:17:09 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 02 Mar 2021 17:17:09 +0100
changeset 8143
2c730d5fd177
parent 7980
2c3f14a3c595
child 8166
bd5cd5858503
permissions
-rw-r--r--

Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.

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 """
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
45 filenameRole = Qt.ItemDataRole.UserRole + 1
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
46 lineRole = Qt.ItemDataRole.UserRole + 2
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
47 positionRole = Qt.ItemDataRole.UserRole + 3
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
48 messageRole = Qt.ItemDataRole.UserRole + 4
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
49 fixableRole = Qt.ItemDataRole.UserRole + 5
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
50 codeRole = Qt.ItemDataRole.UserRole + 6
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
51 ignoredRole = Qt.ItemDataRole.UserRole + 7
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
52 argsRole = Qt.ItemDataRole.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)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
111 self.setWindowFlags(Qt.WindowType.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)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
131 itm.setData(Qt.ItemDataRole.UserRole, category)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
132 itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
133 itm.setCheckState(Qt.CheckState.Unchecked)
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
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)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
137 itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
138 itm.setCheckState(Qt.CheckState.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)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
156 self.buttonBox.button(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
157 QDialogButtonBox.StandardButton.Close).setEnabled(False)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 self.resultList.headerItem().setText(self.resultList.columnCount(), "")
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
160 self.resultList.header().setSortIndicator(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
161 0, Qt.SortOrder.AscendingOrder)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162
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
163 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
164 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
165 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
166 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
167
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
168 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
169 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
170
2947
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
171 self.checkProgress.setVisible(False)
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
172 self.checkProgressLabel.setVisible(False)
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
173 self.checkProgressLabel.setMaximumWidth(600)
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
174
3413
5e63f809732a Code style checker: Translations extracted and refactored.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3228
diff changeset
175 self.styleCheckService = styleCheckService
5e63f809732a Code style checker: Translations extracted and refactored.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3228
diff changeset
176 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
177 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
178 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
179 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
180
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
181 self.results = CodeStyleCheckerDialog.noResults
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 self.cancelled = False
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 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
184 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
185 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
186 self.__errorItem = None
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 self.__fileOrFileList = ""
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 self.__project = None
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 self.__forProject = False
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 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
192 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
193 self.__onlyFixes = {}
4437
b9cc331a4576 Some little fixes to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4434
diff changeset
194 self.__noFixCodesList = []
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 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
197
d2bf0476484b CodeStyleCheckerDialog: changed the dialog layout to get more space for the result list.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
198 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
199 self.optionsTabWidget.setCurrentWidget(self.globalOptionsTab)
832
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 def __resort(self):
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 Private method to resort the tree.
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
205 self.resultList.sortItems(self.resultList.sortColumn(),
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 self.resultList.header().sortIndicatorOrder()
3036
30c81c9e88b8 Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
207 )
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
209 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
210 """
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
211 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
212
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
213 @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
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 @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
216 @type str
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
217 """
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
218 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
219 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
220 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
221 self.__errorItem.setExpanded(True)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
222 self.__errorItem.setForeground(0, Qt.GlobalColor.red)
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
223
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
224 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
225 message)
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
226 if not self.resultList.findItems(msg, Qt.MatchFlag.MatchExactly):
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
227 itm = QTreeWidgetItem(self.__errorItem, [msg])
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
228 itm.setForeground(0, Qt.GlobalColor.red)
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
229 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
230
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
231 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
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 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
234
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 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
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 @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
238 @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
239 """
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 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
241 "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
242 "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
243 "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
244 "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
245 "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
246 "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
247 "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
248 "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
249 "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
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 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
252
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
253 def __createResultItem(self, filename, result):
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 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
256
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
257 @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
258 @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
259 @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
260 @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
261 @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
262 @rtype QTreeWidgetItem
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 """
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
264 from .CodeStyleFixer import FixableCodeStyleIssues
2404
cba0ff902c2b Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
265
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 if self.__lastFileItem is None:
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 # 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
268 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
269 self.__project.getRelativePath(filename)])
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 self.__lastFileItem.setFirstColumnSpanned(True)
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 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
272 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
273
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
274 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
275
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
276 fixable = False
3022
57179e4cdadd Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3004
diff changeset
277 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
278 self.__lastFileItem, [
646742c260bd Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7611
diff changeset
279 "{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
280 msgCode,
7614
646742c260bd Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7611
diff changeset
281 result["display"]
646742c260bd Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7611
diff changeset
282 ]
646742c260bd Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7611
diff changeset
283 )
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
284 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
285 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
286 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
287 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
288 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
289 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
290 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
291 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
292 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
293 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
294 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
295 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
296 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
297 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
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"))
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
300 else:
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
301 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
302 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
303 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
304 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
305 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
306 elif (
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 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
308 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
309 msgCode not in self.__noFixCodesList
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
310 ):
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
311 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
312 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
313
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
314 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
315 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter)
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
316
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
317 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignVCenter)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
318 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignVCenter)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
319 itm.setTextAlignment(2, Qt.AlignmentFlag.AlignVCenter)
853
ec7dd115e26b Continued implementing a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 849
diff changeset
320
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
321 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
322 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
323 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
324 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
325 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
326 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
327 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
328 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
329
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
330 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
331 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
332 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
333 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
334 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
335
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
336 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
337
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
338 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
339 """
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 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
341 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
342
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
343 @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
344 @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
345 @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
346 @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
347 """
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
348 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
349 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
350 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
351
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
352 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
353 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
354 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
355 itm.setData(0, self.fixableRole, False)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356
7615
ca2949b1a29a Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7614
diff changeset
357 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
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 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
360
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
361 @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
362 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
363 @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
364 @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
365 @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
366 @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
367 @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
368 @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
369 @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
370 """
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
371 self.__statistics["_FilesCount"] += 1
3056
9986ec0e559a Merge with default branch before style changes.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2911 2947
diff changeset
372 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
373 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
374 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
375 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
376 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
377 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
378 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
379 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
380 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
381 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
382 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
383
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
384 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
385 """
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
386 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
387
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
388 @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
389 @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
390 """
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
391 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
392
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
393 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
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 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
396 """
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 = {}
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
398 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
399 self.__statistics["_FilesIssues"] = 0
853
ec7dd115e26b Continued implementing a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 849
diff changeset
400 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
401 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
402 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
403
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 def prepare(self, fileList, project):
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 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
407
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
408 @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
409 @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
410 @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
411 @type Project
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 self.__fileOrFileList = fileList[:]
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 self.__project = project
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 self.__forProject = True
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
417 self.buttonBox.button(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
418 QDialogButtonBox.StandardButton.Close).setEnabled(True)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
419 self.buttonBox.button(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
420 QDialogButtonBox.StandardButton.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
421 self.cancelButton.setEnabled(False)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 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
424 if (
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
425 self.__data is None or
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
426 len(self.__data) < 6
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
427 ):
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 # initialize the data structure
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 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
430 "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
431 "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
432 "IncludeMessages": "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
433 "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
434 "FixCodes": "",
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
435 "FixIssues": False,
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 }
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
437 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
438 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
439 CodeStyleCheckerDialog.checkCategories.keys())
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
440 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
441 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
442 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
443 # 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
444 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
445 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
446 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
447 # top level, method
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
448 if "HangClosing" not in self.__data:
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
449 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
450 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
451 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
452 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
453 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
454 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
455 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
456 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
457 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
458 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
459 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
460 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
461 self.__data["LineComplexityScore"] = 10
4506
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
462 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
463 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
464 MiscellaneousCheckerDefaultArgs["CodingChecker"]
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
465 )
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
466 if (
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
467 "CopyrightMinFileSize" not in self.__data or
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
468 "CopyrightAuthor" not in self.__data
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
469 ):
7980
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["CopyrightMinFileSize"] = (
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
471 MiscellaneousCheckerDefaultArgs[
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
472 "CopyrightChecker"]["MinFilesize"]
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
473 )
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
474 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
475 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
476 )
4509
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
477 if "FutureChecker" not in self.__data:
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
478 self.__data["FutureChecker"] = ""
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
479 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
480 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
481 MiscellaneousCheckerDefaultArgs["BuiltinsChecker"]
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
482 )
7978
1e391f977124 CodeStyleCheckerDialog: added configuration entry for commented code whitelist patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
483
7040
f89952e5fc11 Code Style Checker: added check for commented code that should be removed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
484 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
485 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
486 MiscellaneousCheckerDefaultArgs["CommentedCodeChecker"]
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
487 )
7978
1e391f977124 CodeStyleCheckerDialog: added configuration entry for commented code whitelist patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
488 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
489 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
490 MiscellaneousCheckerDefaultArgs[
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
491 "CommentedCodeChecker"]["WhiteList"][:]
2c3f14a3c595 CodeStyleCheckerDialog: added a commented code whitelist patterns to the Miscellaneous Checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7978
diff changeset
492 )
7978
1e391f977124 CodeStyleCheckerDialog: added configuration entry for commented code whitelist patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
493
7247
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
494 if "AnnotationsChecker" not in self.__data:
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
495 self.__data["AnnotationsChecker"] = {
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
496 "MinimumCoverage": 75,
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
497 "MaximumComplexity": 3,
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
498 }
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
499
7619
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
500 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
501 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
502 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
503 "HardcodedTmpDirectories":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
504 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
505 "InsecureHashes":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
506 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
507 "InsecureSslProtocolVersions":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
508 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
509 "WeakKeySizeDsaHigh":
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_dsa_high"]),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
511 "WeakKeySizeDsaMedium":
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_dsa_medium"]),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
513 "WeakKeySizeRsaHigh":
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_rsa_high"]),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
515 "WeakKeySizeRsaMedium":
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_rsa_medium"]),
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
517 "WeakKeySizeEcHigh":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
518 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
519 "WeakKeySizeEcMedium":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
520 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
521 "CheckTypedException":
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
522 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
523 }
7614
646742c260bd Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7611
diff changeset
524
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
525 self.__initCategoriesList(self.__data["EnabledCheckerCategories"])
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526 self.excludeFilesEdit.setText(self.__data["ExcludeFiles"])
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 self.excludeMessagesEdit.setText(self.__data["ExcludeMessages"])
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528 self.includeMessagesEdit.setText(self.__data["IncludeMessages"])
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
529 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
530 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
531 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
532 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
533 self.ignoredCheckBox.setChecked(self.__data["ShowIgnored"])
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
534 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
535 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
536 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
537 self.blankBeforeMethodSpinBox.setValue(self.__data["BlankLines"][1])
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
538 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
539 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
540 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
541 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
542 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
543 self.lineComplexityScoreSpinBox.setValue(
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
544 self.__data["LineComplexityScore"])
4506
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
545 self.encodingsEdit.setText(self.__data["ValidEncodings"])
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
546 self.copyrightFileSizeSpinBox.setValue(
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
547 self.__data["CopyrightMinFileSize"])
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
548 self.copyrightAuthorEdit.setText(self.__data["CopyrightAuthor"])
4509
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
549 self.__initFuturesList(self.__data["FutureChecker"])
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
550 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
551 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
552 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
553 self.__initCommentedCodeCheckerWhiteList(
1e391f977124 CodeStyleCheckerDialog: added configuration entry for commented code whitelist patterns.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
554 self.__data["CommentedCodeChecker"]["WhiteList"])
7247
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
555 self.minAnnotationsCoverageSpinBox.setValue(
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
556 self.__data["AnnotationsChecker"]["MinimumCoverage"])
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
557 self.maxAnnotationsComplexitySpinBox.setValue(
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
558 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
559
7619
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
560 # security
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
561 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
562 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
563 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
564 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
565 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
566 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
567 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
568 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
569 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
570 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
571 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
572 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
573 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
574 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
575 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
576 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
577 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
578 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
579 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
580 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
581
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
582 self.__cleanupData()
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
583
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
584 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
585 """
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 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
587 """
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.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
589 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
590 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
591 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
592 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
593 if len(self.files) > 1:
7632
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
594 if self.__project:
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
595 self.progressList.addItems([
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
596 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
597 for f in self.files
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
598 ])
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
599 else:
7ac16bf7695b CodeStyleCheckerDialog: further improvements to the progress tab.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7631
diff changeset
600 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
601
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
602 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
603
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 940
diff changeset
604 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
605 """
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
606 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
607
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
608 @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
609 @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
610 @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
611 @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
612 @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
613 @type None or bool
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
614 """
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615 if self.__project is None:
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
616 self.__project = e5App().getObject("Project")
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617
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.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
619
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
620 self.cancelled = False
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
621 self.buttonBox.button(
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7980
diff changeset
622 QDialogButtonBox.StandardButton.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
623 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
624 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
625 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
626 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
627 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
628 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
629 self.restartButton.setEnabled(False)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 if repeat is not None:
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 self.repeatCheckBox.setChecked(repeat)
2947
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
632 self.checkProgress.setVisible(True)
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 QApplication.processEvents()
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 if save:
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 self.__fileOrFileList = fn
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 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
639 self.files = fn[:]
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 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
641 self.files = []
7637
c878e8255972 Removed some more Python2 related code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7632
diff changeset
642 extensions = set(Preferences.getPython("Python3Extensions"))
2607
e5115553185a Fixes and consolidation for PEP8-checker.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2525
diff changeset
643 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
644 self.files.extend(Utilities.direntries(
3065
070b35dde35e Fixed a bunch of indentation issues.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
645 fn, True, '*{0}'.format(ext), 0))
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 else:
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
647 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
648
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 # 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
650 if self.files:
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 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
652 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
653 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
654 for fileFilter in filterList:
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
655 self.files = [
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
656 f for f in self.files
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
657 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
658 ]
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
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
660 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
661 self.__resetStatistics()
3456
96232974dcdb Merge with BgService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3178 3413
diff changeset
662 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
663 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
664 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
665
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
666 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
667 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
668 "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
669
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 # 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
671 excludeMessages = self.__assembleExcludeMessages()
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 includeMessages = self.includeMessagesEdit.text()
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
673 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
674 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
675 noFixCodes = self.noFixIssuesEdit.text()
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
676 self.__noFixCodesList = [
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
677 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
678 ]
849
996367a89673 Started to implement a fixer for PEP 8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 847
diff changeset
679 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
680 self.showIgnored = (
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
681 self.ignoredCheckBox.isChecked() and repeatMessages
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7247
diff changeset
682 )
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
683 maxLineLength = self.lineLengthSpinBox.value()
6786
701b511ba8f5 Added option to set the documentation line length.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6645
diff changeset
684 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
685 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
686 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
687 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
688 )
2866
c77e08c38a5c Extended the PEP-8 dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2864
diff changeset
689 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
690 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
691 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
692 codeComplexityArgs = {
ae4f5cdc3d00 Added a line complexity checker to the code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5636
diff changeset
693 "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
694 "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
695 "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
696 }
4506
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
697 miscellaneousArgs = {
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
698 "CodingChecker": self.encodingsEdit.text(),
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
699 "CopyrightChecker": {
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
700 "MinFilesize": self.copyrightFileSizeSpinBox.value(),
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
701 "Author": self.copyrightAuthorEdit.text(),
4509
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
702 },
7797ee4a45f9 Redid the future imports checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4506
diff changeset
703 "FutureChecker": self.__getSelectedFutureImports(),
5619
ab999dc48132 Made the built-ins checker configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
704 "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
705 "CommentedCodeChecker": {
f89952e5fc11 Code Style Checker: added check for commented code that should be removed.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
706 "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
707 "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
708 }
4506
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
709 }
7247
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
710 annotationArgs = {
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
711 "MinimumCoverage":
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
712 self.minAnnotationsCoverageSpinBox.value(),
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
713 "MaximumComplexity":
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
714 self.maxAnnotationsComplexitySpinBox.value(),
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
715 }
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716
7619
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
717 securityArgs = {
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
718 "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
719 t.strip()
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
720 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
721 ],
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
722 "insecure_hashes": [
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
723 h.strip()
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
724 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
725 ],
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
726 "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
727 p.strip()
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
728 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
729 .splitlines()
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
730 ],
ef2b5af23ce7 Code Style Checker: continued to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7615
diff changeset
731 "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
732 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
733 "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
734 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
735 "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
736 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
737 "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
738 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
739 "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
740 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
741 "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
742 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
743 "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
744 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
745 }
7611
d546c4e72f52 Code Style Checker: started to implement checker for security related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7610
diff changeset
746
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
747 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
748 fixCodes, noFixCodes, fixIssues, maxLineLength,
6786
701b511ba8f5 Added option to set the documentation line length.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 6645
diff changeset
749 maxDocLineLength, blankLines, hangClosing,
7247
bf9379f964f3 Code Style Checker:
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
750 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
751 annotationArgs, securityArgs]
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
752
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
753 # 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
754 self.progress = 0
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
755 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
756 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
757 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
758 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
759 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
760 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
761 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
762 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
763 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
764 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
765 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
766 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
767
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 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
769 """
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 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
771
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
772 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
773 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
774 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
775
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
776 @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
777 @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
778 @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
779 @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
780 """
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 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
782 flags = Utilities.extractFlags(source)
4556
25d1fa006bf0 Process noqa under Python2.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4514
diff changeset
783 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
784 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
785 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
786 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
787 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
788 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
789 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
790
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
791 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
792 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3558
diff changeset
793 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
794
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
795 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
796
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
797 @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
798 @type str
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
799 """
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
800 if not self.files:
2947
bd95f61c4f96 Some enhancements to the coding style checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2929
diff changeset
801 self.checkProgressLabel.setPath("")
832
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
802 self.checkProgress.setMaximum(1)
eb5ff61f927b Added a checker for PEP 8 compliance.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
803 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
804 self.__finish()
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
805 return
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 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
808 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
809 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
810 QApplication.processEvents()
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
811
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
812 if self.cancelled:
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
813 self.__resort()
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
814 return
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
815
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
816 self.__lastFileItem = None
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
817
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
818 if codestring:
4506
57666e501a42 Started to add more code style checkers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
819 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
820 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
821 else:
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
822 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
823 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
824 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
825 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
826 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
827 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
828 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
829 self.progress += 1
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
830 # 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
831 self.check()
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
832 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
833 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
834 ('-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
835 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
836
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
837 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
838
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
839 errors = []
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
840 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
841 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
842 errors.append(error)
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
843 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
844
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
845 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
846 args = options + [
3549
96ebf42cd960 Added the file backup functionality in the code style fixer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
847 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
848 ]
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
849 self.__finished = False
3413
5e63f809732a Code style checker: Translations extracted and refactored.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3228
diff changeset
850 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
851 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
852
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 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
854 """
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 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
856
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 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
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 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
860
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 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
862 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
863
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 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
865 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
866 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
867 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
868 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
869
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
870 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
871 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
872 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
873 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
874 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
875 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
876 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
877 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
878
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
879 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
880 ('-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
881 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
882
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
883 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
884
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
885 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
886 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
887 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
888 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
889 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
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 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
892 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
893 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
894 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
895 ]
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 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
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 # 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
899 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
900 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
901 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
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></