Taskfile lint step can never fail: golangci-lint run || echo "not installed" swallows findings #41

Closed
opened 2026-10-01 21:26:06 +00:00 by mathias · 1 comment
Owner

Found 2026-10-01 while building #33.

Taskfile.yml (lint:):

command -v golangci-lint >/dev/null 2>&1 && golangci-lint run ./... || echo "golangci-lint not installed — skipping (CI installs it)"

A && B || C runs C when B fails, not only when A fails. So when golangci-lint is installed and reports findings, the task prints the misleading "not installed — skipping" line and exits 0. task check therefore never fails on lint, locally or in CI.

Evidence. CI run 8730 (job 12843) for feat/33-audio-upload-transcript installed golangci-lint 2.11.4, printed 3 errcheck findings, then printed "golangci-lint not installed — skipping (CI installs it)" and went on to task: [test]; the run concluded success.

Fix (suggested). Distinguish "absent" from "failed":

if command -v golangci-lint >/dev/null 2>&1; then golangci-lint run ./...; else echo "golangci-lint not installed — skipping (CI installs it)"; fi

Expect the first CI run after the fix to be red if anything else has accumulated; the 3 known findings (all in #33 code) are already fixed on that branch, and a full-module golangci-lint run ./... there reports 0.

Why it matters. Every "task check green" claim in this repo has covered format, vet and tests but not lint. Not fixed in the #33 PR to keep that diff to the feature.


Created via git-mcp on behalf of @mathias

Found 2026-10-01 while building #33. `Taskfile.yml` (`lint:`): ``` command -v golangci-lint >/dev/null 2>&1 && golangci-lint run ./... || echo "golangci-lint not installed — skipping (CI installs it)" ``` `A && B || C` runs C when **B fails**, not only when A fails. So when golangci-lint is installed and reports findings, the task prints the misleading "not installed — skipping" line and **exits 0**. `task check` therefore never fails on lint, locally or in CI. **Evidence.** CI run 8730 (job 12843) for `feat/33-audio-upload-transcript` installed golangci-lint 2.11.4, printed 3 `errcheck` findings, then printed "golangci-lint not installed — skipping (CI installs it)" and went on to `task: [test]`; the run concluded `success`. **Fix (suggested).** Distinguish "absent" from "failed": ``` if command -v golangci-lint >/dev/null 2>&1; then golangci-lint run ./...; else echo "golangci-lint not installed — skipping (CI installs it)"; fi ``` Expect the first CI run after the fix to be red if anything else has accumulated; the 3 known findings (all in #33 code) are already fixed on that branch, and a full-module `golangci-lint run ./...` there reports 0. **Why it matters.** Every "task check green" claim in this repo has covered format, vet and tests but not lint. Not fixed in the #33 PR to keep that diff to the feature. --- _Created via git-mcp on behalf of @mathias_
mathias added the size/stype/fix labels 2026-10-01 21:26:06 +00:00
mathias added this to the v0.31.1 - security and robustness milestone 2026-10-03 18:50:00 +00:00
Author
Owner

Fixed in v0.31.1 (e037c6b). task lint now fails on findings; TestTaskLint_* runs the real Taskfile in a scratch module, TestTaskCheck_RunsTheLintStep pins that check runs it. CI run 8940 on main is green with the gate live. CI run 8937 went red on my own test (task prints colour codes in CI, my prefix match missed the notice line); fixed in 5baffd0 with a red test first. Closing.


Created via git-mcp on behalf of @mathias

Fixed in v0.31.1 (e037c6b). `task lint` now fails on findings; `TestTaskLint_*` runs the real Taskfile in a scratch module, `TestTaskCheck_RunsTheLintStep` pins that `check` runs it. CI run 8940 on main is green with the gate live. CI run 8937 went red on my own test (task prints colour codes in CI, my prefix match missed the notice line); fixed in 5baffd0 with a red test first. Closing. --- _Created via git-mcp on behalf of @mathias_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/tapir#41