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