-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
questionAsking for support or clarificationAsking for support or clarification
Description
In Ruff version 0.7.3, SIM115 is not recognized in a case that was recognized in 0.7.2:
file.py
from __future__ import annotations
import traceback
from typing import Any, IO
def open_file(
filename: str,
mode: str,
encoding: str | None = None,
) -> IO[Any] | None:
"""Return file handle. Return None on failure."""
try:
# Line below previously correctly triggered `SIM115`
return open(filename, mode, encoding=encoding)
except FileNotFoundError:
print("File Not Found.")
except (OSError, BaseException) as exc:
print(exc)
traceback.print_exception(exc)
return NoneNoted line no longer triggers SIM115, where I argue it might be more correct to do so.
ruff check --isolated --select=SIM115 file.py~ > ruff --version
ruff 0.7.3Metadata
Metadata
Assignees
Labels
questionAsking for support or clarificationAsking for support or clarification