--- a/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Fri Nov 11 17:49:06 2022 +0100 +++ b/src/eric7/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Sat Nov 12 17:49:08 2022 +0100 @@ -42,7 +42,8 @@ """ Constructor - @param parent The parent widget. (QWidget) + @param parent reference to the parent widget + @type QWidget """ super().__init__(parent) self.setupUi(self) @@ -117,12 +118,18 @@ """ Private method to create an entry in the result list. - @param filename file name of file (string) - @param line line number of faulty source (integer or string) - @param index index number of fault (integer) - @param error error text (string) - @param sourcecode faulty line of code (string) - @param isWarning flag indicating a warning message (boolean) + @param filename file name of file + @type str + @param line line number of faulty source + @type int or str + @param index index number of fault + @type int + @param error error text + @type str + @param sourcecode faulty line of code + @type str + @param isWarning flag indicating a warning message + @type bool """ if ( self.__lastFileItem is None @@ -154,8 +161,10 @@ """ Public method to prepare the dialog with a list of filenames. - @param fileList list of filenames (list of strings) - @param project reference to the project object (Project) + @param fileList list of filenames + @type list of str + @param project reference to the project object + @type Project """ self.__fileList = fileList[:] self.__project = project @@ -171,14 +180,46 @@ self.__data = {"ExcludeFiles": ""} self.excludeFilesEdit.setText(self.__data["ExcludeFiles"]) + def startForBrowser(self, fn): + """ + Public slot to start the syntax check for the project sources browser. + + @param fn file or list of files or directory to be checked + @type str or list of str + """ + if isinstance(fn, list): + files = fn + elif os.path.isdir(fn): + files = [] + for ext in self.syntaxCheckService.getExtensions(): + files.extend(Utilities.direntries(fn, True, "*{0}".format(ext), 0)) + else: + files = [fn] + + if files: + if self.__project is None: + self.__project = ericApp().getObject("Project") + + self.__fileList = files[:] + + self.filterFrame.setVisible(True) + + self.__data = self.__project.getData("CHECKERSPARMS", "SyntaxChecker") + if self.__data is None or "ExcludeFiles" not in self.__data: + self.__data = {"ExcludeFiles": ""} + self.excludeFilesEdit.setText(self.__data["ExcludeFiles"]) + + self.on_startButton_clicked() # press the start button + def start(self, fn, codestring=""): """ Public slot to start the syntax check. @param fn file or list of files or directory to be checked - (string or list of strings) - @param codestring string containing the code to be checked (string). - If this is given, fn must be a single file name. + @type str or list of str + @param codestring string containing the code to be checked. If this is given, + fn must be a single file name. + @type str """ self.__batch = False @@ -236,7 +277,8 @@ The results are reported to the __processResult slot. - @param codestring optional sourcestring (str) + @param codestring optional sourcestring + @type str """ if self.syntaxCheckService is None or not self.files: self.checkProgress.setMaximum(1) @@ -341,11 +383,13 @@ """ Private slot to display the reported messages. - @param fn filename of the checked file (str) + @param fn filename of the checked file + @type str @param problems dictionary with the keys 'error' and 'warnings' which hold a list containing details about the error/ warnings (file name, line number, column, codestring (only at syntax - errors), the message) (dict) + errors), the message) + @type dict """ if self.__finished: return @@ -429,7 +473,8 @@ """ Private slot called by a button of the button box clicked. - @param button button that was clicked (QAbstractButton) + @param button button that was clicked + @type QAbstractButton """ if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): self.close() @@ -470,8 +515,10 @@ """ Private slot to handle the activation of an item. - @param itm reference to the activated item (QTreeWidgetItem) - @param col column the item was activated in (integer) + @param itm reference to the activated item + @type QTreeWidgetItem + @param col column the item was activated in + @type int """ if self.noResults: return @@ -559,7 +606,8 @@ Private method to clear all error and warning markers of open editors to be checked. - @param files list of files to be checked (list of string) + @param files list of files to be checked + @type list of str """ vm = ericApp().getObject("ViewManager") openFiles = vm.getOpenFilenames()