chore(lint): adopt canonical golangci-lint config

Replace .golangci.yml with the shared canonical config. The old
config's top-level linters-settings block was silently ignored under
the v2 schema, so the lll/funlen/cyclop/dupl thresholds now actually
apply. The four repo-specific disables (mnd, exhaustive, paralleltest,
testpackage) move out of the config into targeted in-code nolint
directives carrying their original approval dates, keeping the config
byte-identical to the canonical one.

Fixes surfaced by the stricter settings: t.Parallel() added to all 32
tests, 24 overlong lines wrapped or their comments tightened, tcell
control-code returns rewritten as character literals, dupl markers on
the identically-shaped item data tables, and two wsl_v5 defer cuddles.

No behavior changes. The repo has no golangci-lint version pin (no
Dockerfile or CI; make lint runs the host binary, currently v2.12.2),
so there was nothing to bump.
This commit is contained in:
2026-08-07 20:45:02 +00:00
parent 8ce238dd62
commit 63d1e797e2
45 changed files with 218 additions and 56 deletions

View File

@@ -1,3 +1,4 @@
//nolint:testpackage // white-box tests reach unexported state (approved 2026-07-07)
package game
import (
@@ -39,6 +40,7 @@ func driveTurns(t *testing.T, g *RogueGame, n int) {
// TestRunDownStairs stands the hero on the staircase and descends via the
// '>' command through the real turn loop, then checks the level changed.
func TestRunDownStairs(t *testing.T) {
t.Parallel()
// '>' is a free action (After=false), so it is followed by a paying
// rest ('.') to end the command() call; without a paying action the
// turn loop would spin forever on the auto-fed prompt input.
@@ -65,6 +67,8 @@ func TestRunDownStairs(t *testing.T) {
// quit and death paths that normally show it now exit the process, so the
// display is exercised through score() directly.
func TestScoreRendersList(t *testing.T) {
t.Parallel()
g := New(Params{Seed: 1, Term: &testTerm{}})
g.Player.Purse = 100
@@ -90,6 +94,8 @@ func TestScoreRendersList(t *testing.T) {
// The hero is fortified so no death exits the process (step 8), and the fixed
// seed keeps it deterministic.
func TestDeepPlaythrough(t *testing.T) {
t.Parallel()
g := New(Params{Seed: 4242, Wizard: true, Term: &testTerm{}})
g.startLevel()
g.prePlay()
@@ -155,6 +161,7 @@ func TestDeepPlaythrough(t *testing.T) {
// and traps. The hero is fortified each turn so nothing exits the process,
// and the fixed seeds keep it deterministic; the point is to surface panics.
func TestTurnLoopCrashSweep(t *testing.T) {
t.Parallel()
// A generous mix of movement, search, and rest. The spaces between
// commands double as answers to any --More-- prompt (wait_for eats
// everything up to a space); without them one prompt would swallow the