Running uv run task lint or uv run task format on a clean checkout of master reports roughly 1300 findings and rewrites about 120 files that CI considers perfectly fine. One of the autofixes produces broken code.
Reproduction
git checkout master
uv run pre-commit run --all-files # all hooks pass
uv run task lint # ~1300 findings
uv run task format # rewrites ~120 files
Root cause
The two tasks invoke linters the project does not actually use:
lint = "black --check --diff . && ruff check . && mypy ."
format = "black . && ruff check --fix --exit-non-zero-on-fix ."
- There is no ruff configuration anywhere in the repository — no
[tool.ruff] in pyproject.toml, no ruff.toml, no .ruff.toml. Ruff therefore runs against its own defaults, which have no relationship to the style the codebase is written in.
- Ruff is not in
.pre-commit-config.yaml, and .github/workflows/pre-commit.yml is the only lint job in CI. Ruff has never gated a single commit.
mypy . walks the whole monorepo, including carbonserver/ and webapp/, rather than the -m codecarbon scope the existing mypy-check task uses.
The style that is enforced comes from pre-commit: autoflake, isort, black (pinned), and flake8 with .flake8.
Impact
Contributors and coding agents are told by CLAUDE.md and docs/how-to/agent-instructions.md to run these tasks before submitting. Doing so either buries a real change under a repo-wide reformat, or requires manually reverting all of it. Worse, ruff's SIM117 autofix currently rewrites a nested with in tests/test_powermetrics.py into syntactically invalid Python.
Expected
task lint and task format should run what CI runs, and pass on a clean master.
Also in scope
Two adjacent dead entries in the same task table:
precommit = "c" — the command is the stray string c.
docs-check-drift = "python scripts/check-docs-drift.py" — that script does not exist.
Running
uv run task lintoruv run task formaton a clean checkout ofmasterreports roughly 1300 findings and rewrites about 120 files that CI considers perfectly fine. One of the autofixes produces broken code.Reproduction
Root cause
The two tasks invoke linters the project does not actually use:
[tool.ruff]inpyproject.toml, noruff.toml, no.ruff.toml. Ruff therefore runs against its own defaults, which have no relationship to the style the codebase is written in..pre-commit-config.yaml, and.github/workflows/pre-commit.ymlis the only lint job in CI. Ruff has never gated a single commit.mypy .walks the whole monorepo, includingcarbonserver/andwebapp/, rather than the-m codecarbonscope the existingmypy-checktask uses.The style that is enforced comes from pre-commit: autoflake, isort, black (pinned), and flake8 with
.flake8.Impact
Contributors and coding agents are told by
CLAUDE.mdanddocs/how-to/agent-instructions.mdto run these tasks before submitting. Doing so either buries a real change under a repo-wide reformat, or requires manually reverting all of it. Worse, ruff'sSIM117autofix currently rewrites a nestedwithintests/test_powermetrics.pyinto syntactically invalid Python.Expected
task lintandtask formatshould run what CI runs, and pass on a cleanmaster.Also in scope
Two adjacent dead entries in the same task table:
precommit = "c"— the command is the stray stringc.docs-check-drift = "python scripts/check-docs-drift.py"— that script does not exist.