363 # now go through all the files |
364 # now go through all the files |
364 self.progress = 0 |
365 self.progress = 0 |
365 self.files.sort() |
366 self.files.sort() |
366 self.check() |
367 self.check() |
367 |
368 |
368 def check(self, codestring='', onlyFixes={}): |
369 def check(self, codestring=''): |
369 """ |
370 """ |
370 Public method to start a style check for one file. |
371 Public method to start a style check for one file. |
371 |
372 |
372 The results are reported to the __processResult slot. |
373 The results are reported to the __processResult slot. |
373 |
374 |
374 @keyparam codestring optional sourcestring (str) |
375 @keyparam codestring optional sourcestring (str) |
375 @keyparam onlyFixes dict which violations should be fixed (dict) |
|
376 """ |
376 """ |
377 if not self.files: |
377 if not self.files: |
378 self.checkProgressLabel.setPath("") |
378 self.checkProgressLabel.setPath("") |
379 self.checkProgress.setMaximum(1) |
379 self.checkProgress.setMaximum(1) |
380 self.checkProgress.setValue(1) |
380 self.checkProgress.setValue(1) |
414 self.check() |
414 self.check() |
415 return |
415 return |
416 |
416 |
417 errors = [] |
417 errors = [] |
418 self.__itms = [] |
418 self.__itms = [] |
419 for error, itm in onlyFixes.get(self.filename, []): |
419 for error, itm in self.__onlyFixes.pop(self.filename, []): |
420 errors.append(error) |
420 errors.append(error) |
421 self.__itms.append(itm) |
421 self.__itms.append(itm) |
422 |
422 |
423 eol = self.__getEol(self.filename) |
423 eol = self.__getEol(self.filename) |
424 args = self.__options + [ |
424 args = self.__options + [ |
450 ignoredErrors = 0 |
450 ignoredErrors = 0 |
451 if self.__itms: |
451 if self.__itms: |
452 for itm, (lineno, position, text, ignored, fixed, autofixing) in \ |
452 for itm, (lineno, position, text, ignored, fixed, autofixing) in \ |
453 zip(self.__itms, results): |
453 zip(self.__itms, results): |
454 self.__modifyFixedResultItem(itm, text, fixed) |
454 self.__modifyFixedResultItem(itm, text, fixed) |
455 self.__updateFixerStatistics(fixes) |
455 self.__updateFixerStatistics(fixes) |
456 else: |
456 else: |
457 for lineno, position, text, ignored, fixed, autofixing in results: |
457 for lineno, position, text, ignored, fixed, autofixing in results: |
458 if ignored: |
458 if ignored: |
459 ignoredErrors += 1 |
459 ignoredErrors += 1 |
460 if self.showIgnored: |
460 if self.showIgnored: |
810 itm.data(0, self.positionRole), |
810 itm.data(0, self.positionRole), |
811 "{0} {1}".format(itm.data(0, self.codeRole), |
811 "{0} {1}".format(itm.data(0, self.codeRole), |
812 itm.data(0, self.messageRole))), |
812 itm.data(0, self.messageRole))), |
813 itm |
813 itm |
814 )) |
814 )) |
815 ##! |
815 |
816 # update the configuration values (3: fixCodes, 4: noFixCodes, |
816 # update the configuration values (3: fixCodes, 4: noFixCodes, |
817 # 5: fixIssues, 6: maxLineLength) |
817 # 5: fixIssues, 6: maxLineLength) |
818 self.__options[3] = self.fixIssuesEdit.text() |
818 self.__options[3] = self.fixIssuesEdit.text() |
819 self.__options[4] = self.noFixIssuesEdit.text() |
819 self.__options[4] = self.noFixIssuesEdit.text() |
820 self.__options[5] = True |
820 self.__options[5] = True |
823 self.files = list(fixesDict.keys()) |
823 self.files = list(fixesDict.keys()) |
824 # now go through all the files |
824 # now go through all the files |
825 self.progress = 0 |
825 self.progress = 0 |
826 self.files.sort() |
826 self.files.sort() |
827 self.cancelled = False |
827 self.cancelled = False |
828 self.check(onlyFixes=fixesDict) |
828 self.__onlyFixes = fixesDict |
|
829 self.check() |
829 |
830 |
830 def __getSelectedFixableItems(self): |
831 def __getSelectedFixableItems(self): |
831 """ |
832 """ |
832 Private method to extract all selected items for fixable issues. |
833 Private method to extract all selected items for fixable issues. |
833 |
834 |