fix: resolve CI linting failures by adding ruff configuration
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import sys
|
||||
import os
|
||||
from typing import Optional, Tuple
|
||||
from typing import Optional, Tuple, IO
|
||||
|
||||
import click
|
||||
|
||||
from errorfix.rules import RuleLoader
|
||||
from errorfix.patterns import PatternMatcher
|
||||
from errorfix.formatters import TextFormatter, JSONFormatter, StructuredFormatter
|
||||
from errorfix.formatters import TextFormatter, JSONFormatter, StructuredFormatter, Formatter
|
||||
from errorfix.plugins import PluginLoader
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ def cli(ctx: click.Context, rules_path: Tuple[str], plugin: Tuple[str], verbose:
|
||||
@click.pass_context
|
||||
def fix(
|
||||
ctx: click.Context,
|
||||
error_input: click.File,
|
||||
error_input: IO[str],
|
||||
output_format: str,
|
||||
language: Optional[str],
|
||||
tool: Optional[str],
|
||||
@@ -56,7 +56,12 @@ def fix(
|
||||
if error_input == sys.stdin and hasattr(sys.stdin, 'closed') and sys.stdin.closed:
|
||||
error_text = ''
|
||||
else:
|
||||
error_text = error_input.read() if error_input and error_input != '-' else ''
|
||||
error_text = ''
|
||||
if error_input and error_input != '-':
|
||||
try:
|
||||
error_text = error_input.read()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
rule_loader = get_rule_loader()
|
||||
matcher = get_pattern_matcher()
|
||||
@@ -98,7 +103,7 @@ def fix(
|
||||
matches = matcher.match_all(error_text, rules_list, limit=limit)
|
||||
|
||||
if output_format == 'json':
|
||||
formatter = JSONFormatter(pretty=not no_color)
|
||||
formatter: Formatter = JSONFormatter(pretty=not no_color)
|
||||
elif output_format == 'structured':
|
||||
formatter = StructuredFormatter()
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user