Skip to content

Commit

Permalink
fix linting and typechecking errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jvllmr committed Apr 20, 2024
1 parent b5f4ca9 commit 45e600e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
19 changes: 11 additions & 8 deletions src/fixit/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,24 @@
import traceback
from functools import partial
from pathlib import Path
from typing import Generator, Iterable, List, Literal, Optional, Union
from typing import Generator, Iterable, List, Optional

import click
import trailrunner
from moreorless.click import echo_color_precomputed_diff

from .config import (
collect_rules,
generate_config,
output_formats_templates,
OutputFormatTypeInput,
)
from .config import collect_rules, generate_config, output_formats_templates
from .engine import LintRunner
from .format import format_module
from .ftypes import Config, FileContent, LintViolation, Options, Result, STDIN
from .ftypes import (
Config,
FileContent,
LintViolation,
Options,
OutputFormatTypeInput,
Result,
STDIN,
)

LOG = logging.getLogger(__name__)

Expand Down
14 changes: 7 additions & 7 deletions src/fixit/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
from fixit import __version__

from .api import fixit_paths, print_result
from .config import (
collect_rules,
generate_config,
get_cwd_config,
output_formats_templates,
from .config import collect_rules, generate_config, get_cwd_config, parse_rule
from .ftypes import (
Config,
LSPOptions,
Options,
OutputFormatTypeInput,
parse_rule,
QualifiedRule,
Tags,
)
from .ftypes import Config, LSPOptions, Options, QualifiedRule, Tags
from .rule import LintRule
from .testing import generate_lint_rule_test_cases
from .util import capture
Expand Down
5 changes: 2 additions & 3 deletions src/fixit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import platform
import sys
from contextlib import contextmanager, ExitStack
from functools import reduce

from pathlib import Path
from types import ModuleType
from typing import (
Expand All @@ -20,7 +20,6 @@
Iterable,
Iterator,
List,
Literal,
Mapping,
Optional,
Sequence,
Expand Down Expand Up @@ -62,7 +61,7 @@
CWD_CONFIG_KEYS = ("output-format", "output-template")


output_formats_templates: dict[OutputFormatType, str] = {
output_formats_templates: Dict[OutputFormatType, str] = {
"fixit": "{path}@{start_line}:{start_col} {rule_name}: {message}",
"vscode": "{path}:{start_line}:{start_col} {rule_name}: {message}",
}
Expand Down
4 changes: 1 addition & 3 deletions src/fixit/ftypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
Container,
ContextManager,
Dict,
get_args,
Iterable,
List,
Literal,
Expand Down Expand Up @@ -230,7 +229,6 @@ class Config:
# post-run processing
formatter: Optional[str] = None


def __post_init__(self) -> None:
self.path = self.path.resolve()
self.root = self.root.resolve()
Expand All @@ -241,7 +239,7 @@ class CwdConfig:
output_format: OutputFormatTypeInput = "fixit"
output_template: str = ""

def __post_init__(self):
def __post_init__(self) -> None:
from .config import output_formats_templates

self.output_template = output_formats_templates["fixit"]
Expand Down
4 changes: 2 additions & 2 deletions src/fixit/tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def collect_types(cfg: Config) -> List[Type[LintRule]]:
)
self.assertListEqual([UseTypesFromTyping], rules)

def test_cwd_config(self):
def test_cwd_config(self) -> None:
prev_cwd = Path.cwd()
os.chdir(str(self.outer))
try:
Expand Down Expand Up @@ -566,7 +566,7 @@ def test_cwd_config(self):
finally:
os.chdir(str(prev_cwd))

def test_format_output(self):
def test_format_output(self) -> None:
prev_cwd = Path.cwd()
try:
os.chdir(str(self.tdp))
Expand Down

0 comments on commit 45e600e

Please sign in to comment.