From ebb16caba918fa1965fdb6e61c513843037a1227 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Tue, 25 Aug 2026 21:24:27 +0800 Subject: [PATCH] build: make Ruff lint baseline explicit Co-Authored-By: Codex --- pyproject.toml | 8 +++++++- tests/test_ruff_lint_contract.py | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/test_ruff_lint_contract.py diff --git a/pyproject.toml b/pyproject.toml index ba4f2a7..fcd2334 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ dependencies = [ ] [project.optional-dependencies] -test = ["build>=1.2", "pytest>=8", "ruff==0.15.22"] +test = ["build>=1.2", "pytest>=8", "ruff==0.16.4"] [project.scripts] qsp-build-crisis-response-shadow-signal = "quant_strategy_plugins.crisis_response_shadow_plugin:main" @@ -40,3 +40,9 @@ testpaths = ["tests"] [tool.ruff] target-version = "py311" line-length = 120 + +[tool.ruff.lint] +# Ruff 0.16 expands its default rule set. Keep the established project +# baseline explicit so a tool upgrade never silently turns style policy into +# a broad source rewrite. +select = ["E4", "E7", "E9", "F"] diff --git a/tests/test_ruff_lint_contract.py b/tests/test_ruff_lint_contract.py new file mode 100644 index 0000000..15e7be6 --- /dev/null +++ b/tests/test_ruff_lint_contract.py @@ -0,0 +1,10 @@ +from __future__ import annotations + +import tomllib +from pathlib import Path + + +def test_ruff_rule_selection_is_explicit_and_stable() -> None: + config = tomllib.loads((Path(__file__).parents[1] / "pyproject.toml").read_text(encoding="utf-8")) + + assert config["tool"]["ruff"]["lint"]["select"] == ["E4", "E7", "E9", "F"]