Skip to content

Commit

Permalink
Fix type issues
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolCat467 committed Sep 15, 2024
1 parent 2054f64 commit 31abea3
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/lintcheck/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,19 @@ def parse_comments(
head = f"{comment['symbol']} ({comment['msg_id']}): "
message_lines = comment["msg"]
assert isinstance(message_lines, str)
line = comment["line"]
assert isinstance(line, int)
column = comment["column"]
assert isinstance(column, int)
for idx, msg in enumerate(reversed(message_lines.splitlines())):
comment = utils.Comment(
message = utils.Comment(
file=filename,
line=comment["line"],
column=comment["column"],
line=line,
column=column,
contents=msg if idx != 0 else f"{head}{msg}",
)

files[filename].append(comment)
files[filename].append(message)
return files


Expand Down Expand Up @@ -194,7 +198,7 @@ def lint_check_add_response_comments(
self,
lint_messages: list[dict[str, str | int]],
only_filename: str | None = None,
) -> list[int]:
) -> dict[str, list[int]]:
"""Add comments for each line given in lint_messages.
Return list of lines where comments were added.
Expand Down Expand Up @@ -242,7 +246,6 @@ def lint_check_add_response_comments(
if target_filename not in files:
continue
file_comments = self.add_lint_comments_for_file(
target_filename,
files[target_filename],
)
file_commented_lines.update(file_comments)
Expand Down Expand Up @@ -305,7 +308,11 @@ def lint_check_event(self, event: Event[Any] | None = None) -> str:
# Run pylint on open file
reporter = Reporter()
try:
run_pylint(args, reporter=reporter, exit=False)
run_pylint(
args,
reporter=reporter, # type: ignore[arg-type]
exit=False,
)
except SystemExit as exc:
traceback.print_exception(exc)
return "break"
Expand Down

0 comments on commit 31abea3

Please sign in to comment.