vpnhide/pyproject.toml
okhsunrog 91013acb54 ci+chore: add ruff (format + lint) for python scripts
Repo had ~1800 lines of Python (kmod/build.py, scripts/*, zygisk/build.py,
portshide/build-zip.py) with no formatter or linter. Long-lived scripts
like scripts/release.py and scripts/codegen-interfaces.py benefit from
catching unused-import / undefined-name / outdated-syntax issues early.

  pyproject.toml — ruff config, target-py312, line-length 100,
                   rules E F W I B UP SIM. Excludes zygisk/third_party,
                   target/, .claude/.
  ci.yml — astral-sh/ruff-action@v4 for `format --check` and `check`,
           ahead of the slow Rust/Gradle steps so it fails fast.
  docs/development.md — add `uvx ruff …` to the local-lint snippet.

Cleanup applied (`ruff format` + `ruff check --fix`):
  - reformat: kmod/build.py, scripts/{changelog_lib,codegen-interfaces,
    release,stats}.py, zygisk/build.py
  - I001: split multi-name imports onto separate lines after the
    sys.path.insert prelude (kmod/build.py, zygisk/build.py)
  - E501 manual: wrap one console.print line in scripts/release.py

Stdlib-only invariant from scripts/build_lib.py is preserved — ruff is
a dev/CI tool, not imported at runtime.
2026-04-26 23:48:37 +03:00

21 lines
779 B
TOML

# Ruff config — applies to every .py in the repo.
# All our scripts are stdlib-only by policy (see scripts/build_lib.py
# header), so ruff is a dev/CI tool here, never a runtime dependency.
[tool.ruff]
target-version = "py312" # CI image (Ubuntu 24.04) ships Python 3.12
line-length = 100
extend-exclude = [
# third-party / vendored — not our code, don't lint
"zygisk/third_party",
# cargo build outputs that may contain stray .py files
"**/target",
# local-only worktrees / agent state, untracked
".claude",
]
[tool.ruff.lint]
# Conservative rule set: pycodestyle (E/W) + pyflakes (F) + isort (I)
# + bugbear foot-guns (B) + pyupgrade (UP) + simplifications (SIM).
# No pylint-style noise, no mypy.
select = ["E", "F", "W", "I", "B", "UP", "SIM"]