Gate pull requests on stylua formatting #3

Merged
benvin merged 2 commits from benvin/stylua-check into main 2026-09-10 21:50:38 +10:00
Member

The repo ships a .stylua.toml and a make fmt target, but nothing has ever run the formatter, so style drift lands unnoticed. Pull requests now fail when Lua source does not match the configured style.

  • add a fmt-check make target running stylua --check over lua, tests and plugin
  • add a fmt step to the lint pipeline fetching pinned stylua v2.5.2 and verifying its sha256
  • reformat tests/installer_spec.lua so the tree is clean
The repo ships a .stylua.toml and a make fmt target, but nothing has ever run the formatter, so style drift lands unnoticed. Pull requests now fail when Lua source does not match the configured style. - add a fmt-check make target running stylua --check over lua, tests and plugin - add a fmt step to the lint pipeline fetching pinned stylua v2.5.2 and verifying its sha256 - reformat tests/installer_spec.lua so the tree is clean
unkin-agent added 2 commits 2026-09-09 23:30:30 +10:00
Gate pull requests on stylua formatting
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
73960b03e2
- add a fmt-check make target running stylua --check over lua, tests and plugin
- add a fmt step to the lint pipeline fetching pinned stylua v2.5.2
- verify the download against its sha256 before use
Author
Member

Blocking: .woodpecker/lint.yaml, fmt step — the fetch script never runs. HOST and ZIP are locally-defined shell vars but are referenced as $$HOST / $$ZIP (bare, no braces). Woodpecker's ${...} preprocessor (drone/envsubst) only rewrites braced ${VAR} forms — bare $VAR passes through untouched. So $$HOST/$$ZIP reach the container's /bin/sh literally, where $$ is the shell's own PID special variable, followed by literal trailing text HOST/ZIP.

Verified in podman/alpine:3.22 with the exact commands from this diff: the curl call resolves to curl: (6) Could not resolve host: <pid>HOST every run — the step fails before it ever reaches make fmt-check. This gate does not gate; it just reds out unconditionally on every PR, always, regardless of formatting.

Fix: use plain $HOST and $ZIP for the two locally-defined vars (no escaping needed — Woodpecker never touches bare $VAR). Keep $${STYLUA_VERSION} and $${STYLUA_SHA256} escaped as-is — those are real ${...}-braced references into Woodpecker-injected environment: vars and do need it.

Everything else checks out: the pinned sha256 matches GitHub's own release digest for v2.5.2 exactly (verified via the GitHub API digest field, and by round-tripping through the artifactapi proxy), the version is explicitly pinned, LUA_SOURCES in the Makefile covers every .lua directory the repo ships, the reformat commit is separate and purely cosmetic, and .stylua.toml column_width agrees with .luacheckrc max_line_length (120/120).

Blocking: `.woodpecker/lint.yaml`, `fmt` step — the fetch script never runs. `HOST` and `ZIP` are locally-defined shell vars but are referenced as `$$HOST` / `$$ZIP` (bare, no braces). Woodpecker's `${...}` preprocessor (drone/envsubst) only rewrites braced `${VAR}` forms — bare `$VAR` passes through untouched. So `$$HOST`/`$$ZIP` reach the container's `/bin/sh` literally, where `$$` is the shell's own PID special variable, followed by literal trailing text `HOST`/`ZIP`. Verified in podman/alpine:3.22 with the exact commands from this diff: the curl call resolves to `curl: (6) Could not resolve host: <pid>HOST` every run — the step fails before it ever reaches `make fmt-check`. This gate does not gate; it just reds out unconditionally on every PR, always, regardless of formatting. Fix: use plain `$HOST` and `$ZIP` for the two locally-defined vars (no escaping needed — Woodpecker never touches bare `$VAR`). Keep `$${STYLUA_VERSION}` and `$${STYLUA_SHA256}` escaped as-is — those are real `${...}`-braced references into Woodpecker-injected `environment:` vars and do need it. Everything else checks out: the pinned sha256 matches GitHub's own release digest for v2.5.2 exactly (verified via the GitHub API digest field, and by round-tripping through the artifactapi proxy), the version is explicitly pinned, `LUA_SOURCES` in the Makefile covers every `.lua` directory the repo ships, the reformat commit is separate and purely cosmetic, and `.stylua.toml` column_width agrees with `.luacheckrc` max_line_length (120/120).
benvin merged commit 7dd8888692 into main 2026-09-10 21:50:38 +10:00
benvin deleted branch benvin/stylua-check 2026-09-10 21:50:38 +10:00
Sign in to join this conversation.