src/eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py

Sat, 12 Nov 2022 17:49:08 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 12 Nov 2022 17:49:08 +0100
branch
eric7
changeset 9508
5a02bdb1dcba
parent 9507
1f39839655ea
child 9624
b47dfa7a137d
permissions
-rw-r--r--

Harmonized the naming of some code in the syntax checker plugin.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
3 # Copyright (c) 2003 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a simple Python syntax checker.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
8943
23f9c7b9e18e Implemented some performance improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
10 import fnmatch
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import os
8943
23f9c7b9e18e Implemented some performance improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
12 import time
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
14 from PyQt6.QtCore import Qt, QTimer, pyqtSlot
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
15 from PyQt6.QtWidgets import (
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
16 QApplication,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
17 QDialog,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
18 QDialogButtonBox,
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
19 QHeaderView,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
20 QTreeWidgetItem,
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
21 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
23 from eric7 import Utilities
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
24 from eric7.EricGui import EricPixmapCache
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9336
diff changeset
25 from eric7.EricWidgets.EricApplication import ericApp
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
27 from .Ui_SyntaxCheckerDialog import Ui_SyntaxCheckerDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 915
diff changeset
29
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 class SyntaxCheckerDialog(QDialog, Ui_SyntaxCheckerDialog):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 Class implementing a dialog to display the results of a syntax check run.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
34
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: 7923
diff changeset
35 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: 7923
diff changeset
36 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: 7923
diff changeset
37 indexRole = 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: 7923
diff changeset
38 errorRole = 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: 7923
diff changeset
39 warningRole = Qt.ItemDataRole.UserRole + 5
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
40
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 915
diff changeset
41 def __init__(self, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
44
9508
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
45 @param parent reference to the parent widget
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
46 @type QWidget
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
48 super().__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 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: 7923
diff changeset
50 self.setWindowFlags(Qt.WindowType.Window)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
51
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
52 self.showButton = self.buttonBox.addButton(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
53 self.tr("Show"), QDialogButtonBox.ButtonRole.ActionRole
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
54 )
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
55 self.showButton.setToolTip(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
56 self.tr("Press to show all files containing an issue")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
57 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
58 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
59 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
60
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.resultList.headerItem().setText(self.resultList.columnCount(), "")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
62 self.resultList.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
63
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 self.noResults = True
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 self.cancelled = False
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
66 self.__lastFileItem = None
5609
5bf0aaa818e9 Added code to safe-guard against self.__batch not being defined in the sytax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
67 self.__batch = False
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
68 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
69 self.__errorItem = None
8943
23f9c7b9e18e Implemented some performance improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
70 self.__timenow = time.monotonic()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
71
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
72 self.__fileList = []
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
73 self.__project = None
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
74 self.filterFrame.setVisible(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75
3091
8239cae3f947 Made the progress bar of the syntax and indentation checker dialogs only visible, while it is checking and only if more than 1 file are being checked.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3064
diff changeset
76 self.checkProgress.setVisible(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
77
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
78 try:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
79 self.syntaxCheckService = ericApp().getObject("SyntaxCheckService")
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
80 self.syntaxCheckService.syntaxChecked.connect(self.__processResult)
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
81 self.syntaxCheckService.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
82 self.syntaxCheckService.error.connect(self.__processError)
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
83 except KeyError:
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
84 self.syntaxCheckService = None
3412
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
85 self.filename = None
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
86
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 def __resort(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 Private method to resort the tree.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
91 self.resultList.sortItems(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
92 self.resultList.sortColumn(), self.resultList.header().sortIndicatorOrder()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
93 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
94
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
95 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
96 """
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
97 Private slot to create a new error item in the result list.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
98
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
99 @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
100 @type str
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
101 @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
102 @type str
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
103 """
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
104 if self.__errorItem is None:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
105 self.__errorItem = QTreeWidgetItem(self.resultList, [self.tr("Errors")])
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
106 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: 7923
diff changeset
107 self.__errorItem.setForeground(0, Qt.GlobalColor.red)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
108
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
109 msg = "{0} ({1})".format(self.__project.getRelativePath(filename), 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: 7923
diff changeset
110 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
111 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: 7923
diff changeset
112 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
113 itm.setFirstColumnSpanned(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
114
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
115 def __createResultItem(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
116 self, filename, line, index, error, sourcecode, isWarning=False
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 Private method to create an entry in the result list.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
120
9508
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
121 @param filename file name of file
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
122 @type str
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
123 @param line line number of faulty source
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
124 @type int or str
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
125 @param index index number of fault
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
126 @type int
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
127 @param error error text
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
128 @type str
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
129 @param sourcecode faulty line of code
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
130 @type str
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
131 @param isWarning flag indicating a warning message
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
132 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 """
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
134 if (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
135 self.__lastFileItem is None
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
136 or self.__lastFileItem.data(0, self.filenameRole) != filename
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
137 ):
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
138 # It's a new file
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
139 self.__lastFileItem = QTreeWidgetItem(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
140 self.resultList, [self.__project.getRelativePath(filename)]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
141 )
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
142 self.__lastFileItem.setFirstColumnSpanned(True)
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
143 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
144 self.__lastFileItem.setData(0, self.filenameRole, filename)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
145
1640
1699d46026cd Fixed a compatibility issue with Qt 4.8.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
146 itm = QTreeWidgetItem(self.__lastFileItem)
88
3701923bccf2 Added my own Python3 port of pyflakes and integrated py3flakes into syntax checker dialog and editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
147 if isWarning:
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9336
diff changeset
148 itm.setIcon(0, EricPixmapCache.getIcon("warning"))
88
3701923bccf2 Added my own Python3 port of pyflakes and integrated py3flakes into syntax checker dialog and editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
149 else:
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9336
diff changeset
150 itm.setIcon(0, EricPixmapCache.getIcon("syntaxError"))
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: 7923
diff changeset
151 itm.setData(0, Qt.ItemDataRole.DisplayRole, line)
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: 7923
diff changeset
152 itm.setData(1, Qt.ItemDataRole.DisplayRole, error)
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: 7923
diff changeset
153 itm.setData(2, Qt.ItemDataRole.DisplayRole, sourcecode)
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
154 itm.setData(0, self.filenameRole, filename)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 466
diff changeset
155 itm.setData(0, self.lineRole, int(line))
915
c1e052773c08 Changed syntax check to report error position within the line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 831
diff changeset
156 itm.setData(0, self.indexRole, index)
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
157 itm.setData(0, self.errorRole, error)
88
3701923bccf2 Added my own Python3 port of pyflakes and integrated py3flakes into syntax checker dialog and editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
158 itm.setData(0, self.warningRole, isWarning)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
159
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
160 def prepare(self, fileList, project):
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
161 """
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
162 Public method to prepare the dialog with a list of filenames.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
163
9508
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
164 @param fileList list of filenames
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
165 @type list of str
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
166 @param project reference to the project object
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
167 @type Project
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
168 """
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
169 self.__fileList = fileList[:]
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
170 self.__project = project
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
171
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
172 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(True)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
173 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
174 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(True)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
175
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
176 self.filterFrame.setVisible(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
177
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
178 self.__data = self.__project.getData("CHECKERSPARMS", "SyntaxChecker")
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
179 if self.__data is None or "ExcludeFiles" not in self.__data:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 915
diff changeset
180 self.__data = {"ExcludeFiles": ""}
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
181 self.excludeFilesEdit.setText(self.__data["ExcludeFiles"])
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
182
9508
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
183 def startForBrowser(self, fn):
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
184 """
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
185 Public slot to start the syntax check for the project sources browser.
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
186
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
187 @param fn file or list of files or directory to be checked
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
188 @type str or list of str
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
189 """
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
190 if isinstance(fn, list):
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
191 files = fn
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
192 elif os.path.isdir(fn):
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
193 files = []
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
194 for ext in self.syntaxCheckService.getExtensions():
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
195 files.extend(Utilities.direntries(fn, True, "*{0}".format(ext), 0))
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
196 else:
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
197 files = [fn]
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
198
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
199 if files:
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
200 if self.__project is None:
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
201 self.__project = ericApp().getObject("Project")
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
202
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
203 self.__fileList = files[:]
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
204
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
205 self.filterFrame.setVisible(True)
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
206
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
207 self.__data = self.__project.getData("CHECKERSPARMS", "SyntaxChecker")
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
208 if self.__data is None or "ExcludeFiles" not in self.__data:
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
209 self.__data = {"ExcludeFiles": ""}
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
210 self.excludeFilesEdit.setText(self.__data["ExcludeFiles"])
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
211
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
212 self.on_startButton_clicked() # press the start button
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
213
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 915
diff changeset
214 def start(self, fn, codestring=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 Public slot to start the syntax check.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
217
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 @param fn file or list of files or directory to be checked
9508
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
219 @type str or list of str
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
220 @param codestring string containing the code to be checked. If this is given,
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
221 fn must be a single file name.
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
222 @type str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 """
5609
5bf0aaa818e9 Added code to safe-guard against self.__batch not being defined in the sytax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5597
diff changeset
224 self.__batch = False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
225
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
226 if self.syntaxCheckService is not None:
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
227 if self.__project is None:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
228 self.__project = ericApp().getObject("Project")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
229
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
230 self.cancelled = False
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
231 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
232 False
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
233 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
234 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
235 True
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
236 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
237 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
238 True
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
239 )
5828
c8deff89c20c Fixed a little issue in the syntax checker dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5609
diff changeset
240 self.showButton.setEnabled(False)
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
241 self.checkProgress.setVisible(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 QApplication.processEvents()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
243
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
244 if isinstance(fn, list):
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
245 self.files = fn
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
246 elif os.path.isdir(fn):
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
247 self.files = []
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
248 for ext in self.syntaxCheckService.getExtensions():
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
249 self.files.extend(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
250 Utilities.direntries(fn, True, "*{0}".format(ext), 0)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
251 )
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
252 else:
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
253 self.files = [fn]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
254
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
255 self.__errorItem = None
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
256 self.__clearErrors(self.files)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
257
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
258 if codestring or len(self.files) > 0:
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
259 self.checkProgress.setMaximum(max(1, len(self.files)))
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
260 self.checkProgress.setVisible(len(self.files) > 1)
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
261 QApplication.processEvents()
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
262
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
263 # now go through all the files
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
264 self.progress = 0
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
265 self.files.sort()
8943
23f9c7b9e18e Implemented some performance improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
266 self.__timenow = time.monotonic()
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
267 if codestring or len(self.files) == 1:
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
268 self.__batch = False
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
269 self.check(codestring)
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
270 else:
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
271 self.__batch = True
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
272 self.checkBatch()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
273
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
274 def check(self, codestring=""):
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
275 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
276 Public method to start a check for one file.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
277
3209
c5432abceb25 CodeStyleChecker moved to background service and done a little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3177
diff changeset
278 The results are reported to the __processResult slot.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
279
9508
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
280 @param codestring optional sourcestring
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
281 @type str
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
282 """
3972
efc9c803ebdc Fixed an issue related to handling an inactive syntax checker in the editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3971
diff changeset
283 if self.syntaxCheckService is None or not self.files:
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
284 self.checkProgress.setMaximum(1)
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
285 self.checkProgress.setValue(1)
3618
49e7fbd66ef9 Fixed behavior and output if a file is deleted outside eric.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3591
diff changeset
286 self.__finish()
49e7fbd66ef9 Fixed behavior and output if a file is deleted outside eric.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3591
diff changeset
287 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
288
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
289 self.filename = self.files.pop(0)
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
290 self.checkProgress.setValue(self.progress)
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
291 QApplication.processEvents()
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
292 self.__resort()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
293
3173
1fb284abe46e Interface to add user-defined services, e.g. in plugins. Auto syntax check working. Little cleanup.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3159
diff changeset
294 if self.cancelled:
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
295 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
296
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
297 self.__lastFileItem = None
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
298
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
299 if codestring:
9507
1f39839655ea Refactored the syntax checker code to get rid of redundancies.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
300 self.source = Utilities.normalizeCode(codestring)
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
301 else:
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
302 try:
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
303 self.source = Utilities.readEncodedFile(self.filename)[0]
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
304 self.source = Utilities.normalizeCode(self.source)
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
305 except (UnicodeError, OSError) as msg:
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
306 self.noResults = False
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
307 self.__createResultItem(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
308 self.filename,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
309 1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
310 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
311 self.tr("Error: {0}").format(str(msg)).rstrip(),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
312 "",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
313 )
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
314 self.progress += 1
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
315 # Continue with next file
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
316 self.check()
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
317 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
318
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
319 self.__finished = False
3241
957673fc463a Interface for adding different languages to the syntax check, background service
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3209
diff changeset
320 self.syntaxCheckService.syntaxCheck(None, self.filename, self.source)
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
321
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
322 def checkBatch(self):
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
323 """
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
324 Public method to start a style check batch job.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
325
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
326 The results are reported to the __processResult slot.
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
327 """
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
328 self.__lastFileItem = None
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
329
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
330 argumentsList = []
8220
006ee31b4835 Applied some more code simplifications suggested by the new Simplify checker (Y113: use enumerate()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
331 for progress, filename in enumerate(self.files, start=1):
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
332 self.checkProgress.setValue(progress)
8943
23f9c7b9e18e Implemented some performance improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
333 if time.monotonic() - self.__timenow > 0.01:
23f9c7b9e18e Implemented some performance improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
334 QApplication.processEvents()
23f9c7b9e18e Implemented some performance improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
335 self.__timenow = time.monotonic()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
336
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
337 try:
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
338 source = Utilities.readEncodedFile(filename)[0]
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
339 source = Utilities.normalizeCode(source)
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
340 except (UnicodeError, OSError) as msg:
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
341 self.noResults = False
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
342 self.__createResultItem(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
343 self.filename,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
344 1,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
345 0,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
346 self.tr("Error: {0}").format(str(msg)).rstrip(),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
347 "",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
348 )
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
349 continue
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
350
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
351 argumentsList.append((filename, source))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
352
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
353 # reset the progress bar to the checked files
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
354 self.checkProgress.setValue(self.progress)
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
355 QApplication.processEvents()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
356
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
357 self.__finished = False
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
358 self.syntaxCheckService.syntaxBatchCheck(argumentsList)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
359
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
360 def __batchFinished(self):
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
361 """
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
362 Private slot handling the completion of a batch job.
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
363 """
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
364 self.checkProgress.setMaximum(1)
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
365 self.checkProgress.setValue(1)
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
366 self.__finish()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
367
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
368 def __processError(self, fn, msg):
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
369 """
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
370 Private slot to process an error indication from the service.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
371
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
372 @param fn filename 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
373 @type str
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
374 @param msg error message
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
375 @type str
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
376 """
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
377 self.__createErrorItem(fn, msg)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
378
4503
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
379 if not self.__batch:
d68dcbe1deb3 Improved the syntax checker, code style checker and indentation checker interfaces.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4501
diff changeset
380 self.check()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
381
3412
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
382 def __processResult(self, fn, problems):
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
383 """
3591
2f2a4a76dd22 Corrected a bunch of source docu issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3515
diff changeset
384 Private slot to display the reported messages.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
385
9508
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
386 @param fn filename of the checked file
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
387 @type str
3412
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
388 @param problems dictionary with the keys 'error' and 'warnings' which
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
389 hold a list containing details about the error/ warnings
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
390 (file name, line number, column, codestring (only at syntax
9508
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
391 errors), the message)
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
392 @type dict
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
393 """
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
394 if self.__finished:
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
395 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
396
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
397 # Check if it's the requested file, otherwise ignore signal if not
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
398 # in batch mode
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
399 if not self.__batch and fn != self.filename:
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
400 return
3412
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
401
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
402 error = problems.get("error")
3412
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
403 if error:
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
404 self.noResults = False
3412
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
405 _fn, lineno, col, code, msg = error
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
406 self.__createResultItem(_fn, lineno, col, msg, code, False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
407
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
408 warnings = problems.get("warnings", [])
3412
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
409 if warnings:
4234
40741c858639 Fixed an issue with the batch syntax check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4231
diff changeset
410 if self.__batch:
40741c858639 Fixed an issue with the batch syntax check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4231
diff changeset
411 try:
40741c858639 Fixed an issue with the batch syntax check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4231
diff changeset
412 source = Utilities.readEncodedFile(fn)[0]
40741c858639 Fixed an issue with the batch syntax check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4231
diff changeset
413 source = Utilities.normalizeCode(source)
4500
884269e383f7 Fixed an issue in the syntax checker dialog causing a faulty display in batch mode.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4433
diff changeset
414 source = source.splitlines()
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
415 except (UnicodeError, OSError):
4234
40741c858639 Fixed an issue with the batch syntax check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4231
diff changeset
416 source = ""
40741c858639 Fixed an issue with the batch syntax check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4231
diff changeset
417 else:
40741c858639 Fixed an issue with the batch syntax check.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4231
diff changeset
418 source = self.source.splitlines()
6188
5a6ae3be31e6 Fixed some loop related coding issues detected by the extended code style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
419 for filename, lineno, col, _code, msg in warnings:
4524
5543f4dec8f7 Fixed an issue in the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4522
diff changeset
420 self.noResults = False
5543f4dec8f7 Fixed an issue in the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4522
diff changeset
421 if source:
5543f4dec8f7 Fixed an issue in the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4522
diff changeset
422 try:
5543f4dec8f7 Fixed an issue in the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4522
diff changeset
423 scr_line = source[lineno - 1].strip()
5543f4dec8f7 Fixed an issue in the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4522
diff changeset
424 except IndexError:
5543f4dec8f7 Fixed an issue in the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4522
diff changeset
425 scr_line = ""
5543f4dec8f7 Fixed an issue in the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4522
diff changeset
426 else:
4522
e41020d3c031 Fixed an issue in the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4503
diff changeset
427 scr_line = ""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
428 self.__createResultItem(filename, lineno, col, msg, scr_line, True)
3412
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
429
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
430 self.progress += 1
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
431 self.checkProgress.setValue(self.progress)
8943
23f9c7b9e18e Implemented some performance improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
432 if time.monotonic() - self.__timenow > 0.01:
23f9c7b9e18e Implemented some performance improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
433 QApplication.processEvents()
23f9c7b9e18e Implemented some performance improvements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8881
diff changeset
434 self.__timenow = time.monotonic()
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
435 self.__resort()
2574
9d6b6cf31ec6 Fix for SyntaxCheckDialog and eflags evaluation.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2525
diff changeset
436
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
437 if not self.__batch:
3159
02cb2adb4868 First implementation for the BackgroundService.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3145
diff changeset
438 self.check()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
439
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 def __finish(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 """
830
6caa4436dee2 Fixed a few smaller issues and some source code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 804
diff changeset
442 Private slot called when the syntax check finished or the user
6caa4436dee2 Fixed a few smaller issues and some source code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 804
diff changeset
443 pressed the button.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 """
4235
81278aff6af9 Fixed an issue in the batch checker cancel function leading to the function not working if the background jobs had finished already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4234
diff changeset
445 if not self.__finished:
81278aff6af9 Fixed an issue in the batch checker cancel function leading to the function not working if the background jobs had finished already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4234
diff changeset
446 self.__finished = True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
447
4235
81278aff6af9 Fixed an issue in the batch checker cancel function leading to the function not working if the background jobs had finished already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4234
diff changeset
448 self.cancelled = True
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
449 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
450 True
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
451 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
452 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
453 False
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
454 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
455 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
456 True
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
457 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
458
4235
81278aff6af9 Fixed an issue in the batch checker cancel function leading to the function not working if the background jobs had finished already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4234
diff changeset
459 if self.noResults:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
460 QTreeWidgetItem(self.resultList, [self.tr("No issues found.")])
4235
81278aff6af9 Fixed an issue in the batch checker cancel function leading to the function not working if the background jobs had finished already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4234
diff changeset
461 QApplication.processEvents()
81278aff6af9 Fixed an issue in the batch checker cancel function leading to the function not working if the background jobs had finished already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4234
diff changeset
462 self.showButton.setEnabled(False)
81278aff6af9 Fixed an issue in the batch checker cancel function leading to the function not working if the background jobs had finished already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4234
diff changeset
463 else:
81278aff6af9 Fixed an issue in the batch checker cancel function leading to the function not working if the background jobs had finished already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4234
diff changeset
464 self.showButton.setEnabled(True)
4236
8d4e498a7af8 Fixed a few coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4235
diff changeset
465 self.resultList.header().resizeSections(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
466 QHeaderView.ResizeMode.ResizeToContents
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
467 )
4235
81278aff6af9 Fixed an issue in the batch checker cancel function leading to the function not working if the background jobs had finished already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4234
diff changeset
468 self.resultList.header().setStretchLastSection(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
469
4235
81278aff6af9 Fixed an issue in the batch checker cancel function leading to the function not working if the background jobs had finished already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4234
diff changeset
470 self.checkProgress.setVisible(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
471
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
472 def on_buttonBox_clicked(self, button):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 Private slot called by a button of the button box clicked.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
475
9508
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
476 @param button button that was clicked
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
477 @type QAbstractButton
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
479 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 self.close()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
481 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel):
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
482 if self.__batch:
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
483 self.syntaxCheckService.cancelSyntaxBatchCheck()
4235
81278aff6af9 Fixed an issue in the batch checker cancel function leading to the function not working if the background jobs had finished already.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4234
diff changeset
484 QTimer.singleShot(1000, self.__finish)
4231
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
485 else:
0b38613388c9 Implemented the batch check mode for the syntax checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
486 self.__finish()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
487 elif button == self.showButton:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488 self.on_showButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
489
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
490 @pyqtSlot()
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
491 def on_startButton_clicked(self):
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
492 """
830
6caa4436dee2 Fixed a few smaller issues and some source code formatting issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 804
diff changeset
493 Private slot to start a syntax check run.
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
494 """
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
495 fileList = self.__fileList[:]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
496
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
497 filterString = self.excludeFilesEdit.text()
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
498 if (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
499 "ExcludeFiles" not in self.__data
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
500 or filterString != self.__data["ExcludeFiles"]
7256
4ef3b78ebb4e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
501 ):
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
502 self.__data["ExcludeFiles"] = filterString
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
503 self.__project.setData("CHECKERSPARMS", "SyntaxChecker", self.__data)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
504 filterList = [f.strip() for f in filterString.split(",") if f.strip()]
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
505 if filterList:
5597
3d88d53f8c2b Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
506 for fileFilter in filterList:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
507 fileList = [f for f in fileList if not fnmatch.fnmatch(f, fileFilter)]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
508
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
509 self.resultList.clear()
793
cd183f89874b Changed the syntac checker dialog and the tabnanny dialog to use the new eflag: marker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
510 self.noResults = True
cd183f89874b Changed the syntac checker dialog and the tabnanny dialog to use the new eflag: marker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
511 self.cancelled = False
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
512 self.start(fileList)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
513
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 def on_resultList_itemActivated(self, itm, col):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 915
diff changeset
516 Private slot to handle the activation of an item.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
517
9508
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
518 @param itm reference to the activated item
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
519 @type QTreeWidgetItem
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
520 @param col column the item was activated in
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
521 @type int
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 if self.noResults:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
525
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
526 vm = ericApp().getObject("ViewManager")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
527
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
528 if itm.parent():
7849
70e464748aaa Utilities: removed some obsolete functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
529 fn = os.path.abspath(itm.data(0, self.filenameRole))
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
530 lineno = itm.data(0, self.lineRole)
915
c1e052773c08 Changed syntax check to report error position within the line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 831
diff changeset
531 index = itm.data(0, self.indexRole)
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
532 error = itm.data(0, self.errorRole)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
533
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
534 vm.openSourceFile(fn, lineno)
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
535 editor = vm.getOpenEditor(fn)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
536
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
537 if itm.data(0, self.warningRole):
3412
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
538 editor.toggleWarning(lineno, 0, True, error)
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
539 else:
915
c1e052773c08 Changed syntax check to report error position within the line.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 831
diff changeset
540 editor.toggleSyntaxError(lineno, index, True, error, show=True)
2195
d6cbd81fb692 Added capability to the syntax checker dialog to show all errors/warnings in an editor when the file entry is double activated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
541 else:
7849
70e464748aaa Utilities: removed some obsolete functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
542 fn = os.path.abspath(itm.data(0, self.filenameRole))
2195
d6cbd81fb692 Added capability to the syntax checker dialog to show all errors/warnings in an editor when the file entry is double activated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
543 vm.openSourceFile(fn)
d6cbd81fb692 Added capability to the syntax checker dialog to show all errors/warnings in an editor when the file entry is double activated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
544 editor = vm.getOpenEditor(fn)
d6cbd81fb692 Added capability to the syntax checker dialog to show all errors/warnings in an editor when the file entry is double activated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
545 for index in range(itm.childCount()):
d6cbd81fb692 Added capability to the syntax checker dialog to show all errors/warnings in an editor when the file entry is double activated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
546 citm = itm.child(index)
d6cbd81fb692 Added capability to the syntax checker dialog to show all errors/warnings in an editor when the file entry is double activated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
547 lineno = citm.data(0, self.lineRole)
d6cbd81fb692 Added capability to the syntax checker dialog to show all errors/warnings in an editor when the file entry is double activated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
548 index = citm.data(0, self.indexRole)
d6cbd81fb692 Added capability to the syntax checker dialog to show all errors/warnings in an editor when the file entry is double activated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
549 error = citm.data(0, self.errorRole)
d6cbd81fb692 Added capability to the syntax checker dialog to show all errors/warnings in an editor when the file entry is double activated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
550 if citm.data(0, self.warningRole):
3412
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
551 editor.toggleWarning(lineno, 0, True, error)
2195
d6cbd81fb692 Added capability to the syntax checker dialog to show all errors/warnings in an editor when the file entry is double activated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
552 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
553 editor.toggleSyntaxError(lineno, index, True, error, show=True)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
554
4433
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4278
diff changeset
555 editor = vm.activeWindow()
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4278
diff changeset
556 editor.updateVerticalScrollBar()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
557
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 @pyqtSlot()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 def on_showButton_clicked(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 Private slot to handle the "Show" button press.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 """
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
563 vm = ericApp().getObject("ViewManager")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
564
3064
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
565 selectedIndexes = []
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 for index in range(self.resultList.topLevelItemCount()):
3064
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
567 if self.resultList.topLevelItem(index).isSelected():
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
568 selectedIndexes.append(index)
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
569 if len(selectedIndexes) == 0:
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
570 selectedIndexes = list(range(self.resultList.topLevelItemCount()))
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
571 for index in selectedIndexes:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
572 itm = self.resultList.topLevelItem(index)
7849
70e464748aaa Utilities: removed some obsolete functions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
573 fn = os.path.abspath(itm.data(0, self.filenameRole))
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
574 vm.openSourceFile(fn, 1)
3064
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
575 editor = vm.getOpenEditor(fn)
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
576 editor.clearSyntaxError()
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
577 editor.clearFlakesWarnings()
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
578 for cindex in range(itm.childCount()):
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
579 citm = itm.child(cindex)
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
580 lineno = citm.data(0, self.lineRole)
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
581 index = citm.data(0, self.indexRole)
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
582 error = citm.data(0, self.errorRole)
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
583 if citm.data(0, self.warningRole):
3412
9364dab2d472 Plug-in docu updated, now the return values of the syntax checker is a dictionary
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3241
diff changeset
584 editor.toggleWarning(lineno, 0, True, error)
3064
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
585 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
586 editor.toggleSyntaxError(lineno, index, True, error, show=True)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
587
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 915
diff changeset
588 # go through the list again to clear syntax error and
3064
2e7054d62218 Fixed an issue with the syntax check dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3062
diff changeset
589 # flakes warning markers for files, that are ok
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
590 openFiles = vm.getOpenFilenames()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
591 errorFiles = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
592 for index in range(self.resultList.topLevelItemCount()):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
593 itm = self.resultList.topLevelItem(index)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
594 errorFiles.append(os.path.abspath(itm.data(0, self.filenameRole)))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
595 for file in openFiles:
3621
15f23ed3f216 Fixed a few source code style issues found by the updated pe8 checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3618
diff changeset
596 if file not in errorFiles:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
597 editor = vm.getOpenEditor(file)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
598 editor.clearSyntaxError()
90
6de42151f9e6 Refined the flakes integration code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 89
diff changeset
599 editor.clearFlakesWarnings()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
600
4433
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4278
diff changeset
601 editor = vm.activeWindow()
7ab862396a8a Workaround for missing lines at vertical scroll bar caused by annotations.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4278
diff changeset
602 editor.updateVerticalScrollBar()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
603
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
604 def __clearErrors(self, files):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
605 """
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
606 Private method to clear all error and warning markers of
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
607 open editors to be checked.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
608
9508
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
609 @param files list of files to be checked
5a02bdb1dcba Harmonized the naming of some code in the syntax checker plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9507
diff changeset
610 @type list of str
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611 """
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
612 vm = ericApp().getObject("ViewManager")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
613 openFiles = vm.getOpenFilenames()
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
614 for file in [f for f in openFiles if f in files]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615 editor = vm.getOpenEditor(file)
88
3701923bccf2 Added my own Python3 port of pyflakes and integrated py3flakes into syntax checker dialog and editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
616 editor.clearSyntaxError()
571
1a4101cb87eb Added filename filters to the syntax checker and tabnanny dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 564
diff changeset
617 editor.clearFlakesWarnings()

eric ide

mercurial