Skip to content

Commit

Permalink
Fix issue when file has no errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolCat467 committed Jan 16, 2024
1 parent e0dbc9c commit de4f747
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/idlemypyextension/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def add_mypy_messages(
to_comment = [only_filename]

# Find first line in target file or use start_line
if not files[only_filename]:
if not files.get(only_filename):
other_files_comment_line = start_line
else:
other_files_comment_line = min(
Expand All @@ -329,6 +329,8 @@ def add_mypy_messages(
)

for target_filename in to_comment:
if target_filename not in files:
continue
file_comments = self.add_type_comments_for_file(
target_filename,
files[target_filename],
Expand Down

0 comments on commit de4f747

Please sign in to comment.