1109 errors, |
1110 errors, |
1110 eol, |
1111 eol, |
1111 encoding, |
1112 encoding, |
1112 Preferences.getEditor("CreateBackupFile"), |
1113 Preferences.getEditor("CreateBackupFile"), |
1113 ] |
1114 ] |
|
1115 self.styleCheckService.styleCheck(None, self.filename, source, args) |
|
1116 |
|
1117 def checkBatch(self): |
|
1118 """ |
|
1119 Public method to start a style check batch job. |
|
1120 |
|
1121 The results are reported to the __processResult slot. |
|
1122 """ |
|
1123 self.__lastFileItem = None |
1114 self.__finished = False |
1124 self.__finished = False |
1115 self.styleCheckService.styleCheck(None, self.filename, source, args) |
|
1116 |
|
1117 def checkBatch(self): |
|
1118 """ |
|
1119 Public method to start a style check batch job. |
|
1120 |
|
1121 The results are reported to the __processResult slot. |
|
1122 """ |
|
1123 self.__lastFileItem = None |
|
1124 |
1125 |
1125 argumentsList = [] |
1126 argumentsList = [] |
1126 for progress, filename in enumerate(self.files, start=1): |
1127 for progress, filename in enumerate(self.files, start=1): |
1127 self.checkProgress.setValue(progress) |
1128 self.checkProgress.setValue(progress) |
1128 if time.monotonic() - self.__timenow > 0.01: |
1129 if time.monotonic() - self.__timenow > 0.01: |
1159 |
1160 |
1160 # reset the progress bar to the checked files |
1161 # reset the progress bar to the checked files |
1161 self.checkProgress.setValue(self.progress) |
1162 self.checkProgress.setValue(self.progress) |
1162 QApplication.processEvents() |
1163 QApplication.processEvents() |
1163 |
1164 |
1164 self.__finished = False |
|
1165 self.styleCheckService.styleBatchCheck(argumentsList) |
1165 self.styleCheckService.styleBatchCheck(argumentsList) |
1166 |
1166 |
1167 def __batchFinished(self): |
1167 def __batchFinished(self): |
1168 """ |
1168 """ |
1169 Private slot handling the completion of a batch job. |
1169 Private slot handling the completion of a batch job. |
1551 @param item reference to the activated item |
1551 @param item reference to the activated item |
1552 @type QTreeWidgetItem |
1552 @type QTreeWidgetItem |
1553 @param column column the item was activated in |
1553 @param column column the item was activated in |
1554 @type int |
1554 @type int |
1555 """ |
1555 """ |
1556 if self.results != CodeStyleCheckerDialog.hasResults: |
1556 if ( |
|
1557 self.results != CodeStyleCheckerDialog.hasResults |
|
1558 or item.data(0, self.filenameRole) is None |
|
1559 ): |
1557 return |
1560 return |
1558 |
1561 |
1559 if item.parent(): |
1562 if item.parent(): |
1560 fn = os.path.abspath(item.data(0, self.filenameRole)) |
1563 fn = os.path.abspath(item.data(0, self.filenameRole)) |
1561 lineno = item.data(0, self.lineRole) |
1564 lineno = item.data(0, self.lineRole) |
1596 selectedIndexes.append(index) |
1599 selectedIndexes.append(index) |
1597 if len(selectedIndexes) == 0: |
1600 if len(selectedIndexes) == 0: |
1598 selectedIndexes = list(range(self.resultList.topLevelItemCount())) |
1601 selectedIndexes = list(range(self.resultList.topLevelItemCount())) |
1599 for index in selectedIndexes: |
1602 for index in selectedIndexes: |
1600 itm = self.resultList.topLevelItem(index) |
1603 itm = self.resultList.topLevelItem(index) |
1601 fn = os.path.abspath(itm.data(0, self.filenameRole)) |
1604 if itm.data(0, self.filenameRole) is not None: |
1602 vm.openSourceFile(fn, 1) |
1605 fn = os.path.abspath(itm.data(0, self.filenameRole)) |
1603 editor = vm.getOpenEditor(fn) |
1606 vm.openSourceFile(fn, 1) |
1604 editor.clearStyleWarnings() |
1607 editor = vm.getOpenEditor(fn) |
1605 for cindex in range(itm.childCount()): |
1608 editor.clearStyleWarnings() |
1606 citm = itm.child(cindex) |
1609 for cindex in range(itm.childCount()): |
1607 lineno = citm.data(0, self.lineRole) |
1610 citm = itm.child(cindex) |
1608 message = citm.data(0, self.messageRole) |
1611 lineno = citm.data(0, self.lineRole) |
1609 editor.toggleWarning( |
1612 message = citm.data(0, self.messageRole) |
1610 lineno, 0, True, message, warningType=EditorWarningKind.Style |
1613 editor.toggleWarning( |
1611 ) |
1614 lineno, 0, True, message, warningType=EditorWarningKind.Style |
|
1615 ) |
1612 |
1616 |
1613 # go through the list again to clear warning markers for files, |
1617 # go through the list again to clear warning markers for files, |
1614 # that are ok |
1618 # that are ok |
1615 openFiles = vm.getOpenFilenames() |
1619 openFiles = vm.getOpenFilenames() |
1616 errorFiles = [] |
1620 errorFiles = [] |