Make script/lint fail on any Hugo warning (closes #25) #46

Merged
clawbot merged 1 commits from issue-25-lint-fails-on-warnings into next 2026-10-21 15:06:17 +02:00
Collaborator

Dockerfile.lint now runs hugo --minify --printPathWarnings --panicOnWarning. With --printPathWarnings alone, Hugo printed "Duplicate target paths" when two pages wrote the same output file and still exited 0, so the lint passed while one of the pages was silently overwritten. --panicOnWarning makes that warning, and any other Hugo warning, fail the lint, as approved in #25 (comment). The comments in Dockerfile.lint, script/lint and script/check, the README entry for script/lint, and TODO.md now say so.

Not visible in the diff: a Hugo upgrade that adds a new warning, or a new page the theme has no layout for, now fails make check, the pre-commit hook and CI. The deploy workflow runs only script/test, so a warning does not stop a deploy.

To repeat the check on a scratch copy (never committed):

  1. Add layouts/_default/single.html containing {{ .Content }} and two files under content/ whose front matter both set url: /collide/; make lint exits non-zero on Hugo's duplicate target paths warning.
  2. Delete those three files; make lint and make check exit 0.

Judgement call: the recipe needs the one-line layout because the theme has none for ordinary pages, and without it Hugo stops first on its "found no layout file" warning instead of the collision.
Judgement call: script/check was not in the plan, but its header said the lint "reports path warnings", which no longer describes it, so that one line changed.

Model: opus-5-5

`Dockerfile.lint` now runs `hugo --minify --printPathWarnings --panicOnWarning`. With `--printPathWarnings` alone, Hugo printed "Duplicate target paths" when two pages wrote the same output file and still exited 0, so the lint passed while one of the pages was silently overwritten. `--panicOnWarning` makes that warning, and any other Hugo warning, fail the lint, as approved in https://git.eeqj.de/sneak/lora.vegas/issues/25#issuecomment-153473. The comments in `Dockerfile.lint`, `script/lint` and `script/check`, the README entry for `script/lint`, and `TODO.md` now say so. Not visible in the diff: a Hugo upgrade that adds a new warning, or a new page the theme has no layout for, now fails `make check`, the pre-commit hook and CI. The deploy workflow runs only `script/test`, so a warning does not stop a deploy. To repeat the check on a scratch copy (never committed): 1. Add `layouts/_default/single.html` containing `{{ .Content }}` and two files under `content/` whose front matter both set `url: /collide/`; `make lint` exits non-zero on Hugo's duplicate target paths warning. 2. Delete those three files; `make lint` and `make check` exit 0. Judgement call: the recipe needs the one-line layout because the theme has none for ordinary pages, and without it Hugo stops first on its "found no layout file" warning instead of the collision. Judgement call: `script/check` was not in the plan, but its header said the lint "reports path warnings", which no longer describes it, so that one line changed. Model: opus-5-5
clawbot added 1 commit 2026-10-21 14:51:55 +02:00
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
clawbot added the needs-review label 2026-10-21 14:51:59 +02:00
clawbot self-assigned this 2026-10-21 14:52:00 +02:00
Author
Collaborator

The review passed.

Model: opus-5-5

The review passed. Model: opus-5-5
clawbot merged commit dc5e368d2b into next 2026-10-21 15:06:17 +02:00
clawbot deleted branch issue-25-lint-fails-on-warnings 2026-10-21 15:06:18 +02:00
clawbot removed the needs-review label 2026-10-21 15:07:08 +02:00
Sign in to join this conversation.