Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/sp_repo_review/checks/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ def check(root: Traversable) -> bool:
return root.joinpath(".pre-commit-config.yaml").is_file()


PY007_VALID_RUNNER_CONFS = frozenset(["noxfile.py", "tox.ini", "tox.toml", "pixi.toml"])


class PY007(General):
"Supports an easy task runner (nox, tox, pixi, etc.)"

Expand All @@ -131,15 +134,11 @@ class PY007(General):
@staticmethod
def check(root: Traversable, pyproject: dict[str, Any]) -> bool:
"""
Projects must have a `noxfile.py`, `tox.ini`, or
Projects must have a `noxfile.py`, `tox.ini`, `tox.toml`, `pixi.toml` or
`tool.hatch.envs`/`tool.spin`/`tool.tox` in `pyproject.toml` to encourage new
contributors.
"""
if root.joinpath("noxfile.py").is_file():
return True
if root.joinpath("tox.ini").is_file():
return True
if root.joinpath("pixi.toml").is_file():
if any(root.joinpath(fn).is_file() for fn in PY007_VALID_RUNNER_CONFS):
return True
match pyproject.get("tool", {}):
case {"hatch": {"envs": object()}}:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from repo_review.testing import compute_check

from sp_repo_review._compat import tomllib
from sp_repo_review.checks.general import PY007_VALID_RUNNER_CONFS


def test_py001(tmp_path: Path):
Expand Down Expand Up @@ -140,7 +141,7 @@ def test_py006_missing(tmp_path: Path):
assert not compute_check("PY006", root=simple).result


@pytest.mark.parametrize("runnerfile", ["noxfile.py", "tox.ini", "pixi.toml"])
@pytest.mark.parametrize("runnerfile", sorted(PY007_VALID_RUNNER_CONFS))
def test_py007(tmp_path: Path, runnerfile: str):
simple = tmp_path / "simple"
simple.mkdir()
Expand Down