Files
lora.vegas/script/lint
T
clawbot dc5e368d2b
check / check (push) Canceled after 0s
Make script/lint fail on any Hugo warning (closes #25)
The lint step in Dockerfile.lint now passes --panicOnWarning alongside
--printPathWarnings. Until now Hugo printed "Duplicate target paths"
when two pages wrote the same output file and still exited 0, so the
lint passed while one page was silently lost. The flag turns that
warning, and every other Hugo warning, into a failed lint.

script/test and the deploy build are unchanged. The comments in
Dockerfile.lint, script/lint and script/check, the README entry for
script/lint, and TODO.md now describe the stricter lint.

Model: opus-5-5
2026-10-21 15:06:16 +02:00

42 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
# script/lint: run the lint. This Hugo site has no dedicated linter, so
# the lint is a Hugo build that fails on any build error and on any Hugo
# warning, including two pages that write the same output path. Where
# it runs is not negotiable. Every lint run happens inside a Docker
# container, so this script does nothing except build Dockerfile.lint.
# The lint is a build step there, so a successful build is a clean lint.
# There is deliberately no host fallback and no "already inside a
# container?" branch: either would be a host lint path wearing a
# disguise.
#
# No --target: Dockerfile.lint has exactly one stage, so the whole-file
# build IS the lint. See that file for why a second, sibling stage would
# be a silent skip.
#
# Dockerfile.lint requires the CHECK_EPOCH build argument, generated
# here exactly as script/cibuild generates it -- see that script for why
# the lint layer must not be allowed to cache, and why the value is
# built in an assignment rather than inline.
set -eu
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
main() {
cd "$ROOT"
epoch="$(date +%s%N)$$"
# --output type=cacheonly: this build is run for its exit status,
# not for an image. Because the lint layer is cache-busted on every
# invocation the result is a new image every time, and an untagged
# build would leave one dangling image per lint run on a host shared
# with other work. cacheonly keeps the build cache (so
# script/bootstrap still hits) and exports nothing. Failures still
# propagate: an empty CHECK_EPOCH or a failing lint exits non-zero.
docker build \
--build-arg CHECK_EPOCH="$epoch" \
--output type=cacheonly \
-f Dockerfile.lint \
.
}
main "$@"