def reset_reporter(linter, output_filepath=None): """Initialize a reporter with config options. Output is an absolute file path to output into. """ # Determine the type of reporter from the config setup. current_reporter = _call_validator(linter.config.pyta_reporter, None, None, None) current_reporter.set_output_filepath(output_filepath) linter.set_reporter(current_reporter) return current_reporter
def reset_reporter(linter, output_filepath=None): """Initialize a reporter with config options. Output is an absolute file path to output into. Cannot use ColorReporter when outputting to a file because the file cannot contain colorama ascii characters -- switches to use PlainReporter.""" # Determine the type of reporter from the config setup. current_reporter = _call_validator(linter.config.pyta_reporter, None, None, None) if isinstance(current_reporter, ColorReporter) and output_filepath: current_reporter = PlainReporter() current_reporter.set_output_filepath(output_filepath) linter.set_reporter(current_reporter) return current_reporter