-
Notifications
You must be signed in to change notification settings - Fork 72
Closed
Description
According to https://beta.ruff.rs/docs/settings/#target-version, the target-version property used for ruff can be inferred from the project.requires-python field, if it is present.
Repo-review currently requires the target-version to be set in
cookie/src/sp_repo_review/checks/ruff.py
Lines 35 to 50 in 884ef32
| class RF002(Ruff): | |
| "Target version must be set" | |
| requires = {"RF001"} | |
| @staticmethod | |
| def check(pyproject: dict[str, Any]) -> bool: | |
| """ | |
| Must select a minimum version to target. Affects pyupgrade, | |
| isort, and others. | |
| """ | |
| match pyproject: | |
| case {"tool": {"ruff": {"target-version": str()}}}: | |
| return True | |
| case _: | |
| return False |
Based on the above, this check could be relaxed a little. Maybe to something like:
class RF002(Ruff):
"Target version must be set"
requires = {"RF001"}
@staticmethod
def check(pyproject: dict[str, Any]) -> bool:
"""
Must select a minimum version to target. Affects pyupgrade,
isort, and others. Can be inferred from project.requires-python.
"""
match pyproject:
case {"tool": {"ruff": {"target-version": str()}}}:
return True
case {"project": {"requires-python": str()}}:
return True
case _:
return FalseOr even something where it is suggested to not specify tool.ruff.target-version whenever project.requires-python is specified.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels