eric6/Plugins/CheckerPlugins/CodeStyleChecker/pycodestyle.py

changeset 8218
7c09585bd960
parent 8208
37836fa8e4ea
equal deleted inserted replaced
8217:385f60c94548 8218:7c09585bd960
2384 2384
2385 class StandardReport(BaseReport): 2385 class StandardReport(BaseReport):
2386 """Collect and print the results of the checks.""" 2386 """Collect and print the results of the checks."""
2387 2387
2388 def __init__(self, options): 2388 def __init__(self, options):
2389 super(StandardReport, self).__init__(options) 2389 super().__init__(options)
2390 self._fmt = REPORT_FORMAT.get(options.format.lower(), 2390 self._fmt = REPORT_FORMAT.get(options.format.lower(),
2391 options.format) 2391 options.format)
2392 self._repeat = options.repeat 2392 self._repeat = options.repeat
2393 self._show_source = options.show_source 2393 self._show_source = options.show_source
2394 self._show_pep8 = options.show_pep8 2394 self._show_pep8 = options.show_pep8
2395 2395
2396 def init_file(self, filename, lines, expected, line_offset): 2396 def init_file(self, filename, lines, expected, line_offset):
2397 """Signal a new file.""" 2397 """Signal a new file."""
2398 self._deferred_print = [] 2398 self._deferred_print = []
2399 return super(StandardReport, self).init_file( 2399 return super().init_file(
2400 filename, lines, expected, line_offset) 2400 filename, lines, expected, line_offset)
2401 2401
2402 def error(self, line_number, offset, text, check): 2402 def error(self, line_number, offset, text, check):
2403 """Report an error, according to options.""" 2403 """Report an error, according to options."""
2404 code = super(StandardReport, self).error(line_number, offset, 2404 code = super().error(line_number, offset,
2405 text, check) 2405 text, check)
2406 if code and (self.counters[code] == 1 or self._repeat): 2406 if code and (self.counters[code] == 1 or self._repeat):
2407 self._deferred_print.append( 2407 self._deferred_print.append(
2408 (line_number, offset, code, text[5:], check.__doc__)) 2408 (line_number, offset, code, text[5:], check.__doc__))
2409 return code 2409 return code
2410 2410
2411 def error_args(self, line_number, offset, code, check, *args): 2411 def error_args(self, line_number, offset, code, check, *args):
2412 """Report an error, according to options.""" 2412 """Report an error, according to options."""
2413 code = super(StandardReport, self).error_args(line_number, offset, 2413 code = super().error_args(line_number, offset,
2414 code, check, *args) 2414 code, check, *args)
2415 if code and (self.counters[code] == 1 or self._repeat): 2415 if code and (self.counters[code] == 1 or self._repeat):
2416 self._deferred_print.append( 2416 self._deferred_print.append(
2417 (line_number, offset, code, args, check.__doc__)) 2417 (line_number, offset, code, args, check.__doc__))
2418 return code 2418 return code
2448 2448
2449 class DiffReport(StandardReport): 2449 class DiffReport(StandardReport):
2450 """Collect and print the results for the changed lines only.""" 2450 """Collect and print the results for the changed lines only."""
2451 2451
2452 def __init__(self, options): 2452 def __init__(self, options):
2453 super(DiffReport, self).__init__(options) 2453 super().__init__(options)
2454 self._selected = options.selected_lines 2454 self._selected = options.selected_lines
2455 2455
2456 def error(self, line_number, offset, text, check): 2456 def error(self, line_number, offset, text, check):
2457 if line_number not in self._selected[self.filename]: 2457 if line_number not in self._selected[self.filename]:
2458 return 2458 return
2459 return super(DiffReport, self).error(line_number, offset, text, check) 2459 return super().error(line_number, offset, text, check)
2460 2460
2461 2461
2462 class StyleGuide(object): 2462 class StyleGuide(object):
2463 """Initialize a PEP-8 instance with few options.""" 2463 """Initialize a PEP-8 instance with few options."""
2464 2464

eric ide

mercurial