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 "testing"
@@ -37,6 +38,8 @@ func setInput(t *testing.T, g *RogueGame, input ...byte) {
}
func TestQuaffHealingPotion(t *testing.T) {
t.Parallel()
g := mkGameInput(t)
pot := newObject()
pot.Kind = KindPotion
@@ -61,6 +64,8 @@ func TestQuaffHealingPotion(t *testing.T) {
}
func TestQuaffConfusionSetsFlagAndFuse(t *testing.T) {
t.Parallel()
g := mkGameInput(t)
pot := newObject()
pot.Kind = KindPotion
@@ -88,6 +93,8 @@ func TestQuaffConfusionSetsFlagAndFuse(t *testing.T) {
}
func TestReadEnchantArmor(t *testing.T) {
t.Parallel()
g := mkGameInput(t)
scr := newObject()
scr.Kind = KindScroll
@@ -105,6 +112,7 @@ func TestReadEnchantArmor(t *testing.T) {
}
func TestReadHoldMonsterFreezesAdjacent(t *testing.T) {
t.Parallel()
// Note: this must not use a greedy monster ('O' orc, ISGREED): the C
// wake_monster gold-guarding check has no ISHELD guard, so the
// look(TRUE) at the end of read_scroll immediately re-wakes greedy
@@ -133,6 +141,8 @@ func TestReadHoldMonsterFreezesAdjacent(t *testing.T) {
// (orc) held by a scroll is re-woken by the look(TRUE) that read_scroll
// performs, ending up both held and running again.
func TestHoldScrollGreedyMonsterQuirk(t *testing.T) {
t.Parallel()
g := mkGameInput(t)
tp := spawnAdjacent(g, 'O')
tp.Flags.Set(Awake)
@@ -158,6 +168,8 @@ func TestHoldScrollGreedyMonsterQuirk(t *testing.T) {
}
func TestZapSlowMonster(t *testing.T) {
t.Parallel()
g := mkGameInput(t)
tp := spawnAdjacent(g, 'Z')
stick := newObject()
@@ -183,6 +195,8 @@ func TestZapSlowMonster(t *testing.T) {
}
func TestParseOpts(t *testing.T) {
t.Parallel()
g := New(Params{Seed: 1})
g.ParseOpts("terse,nojump,name=Conan,fruit=mango,inven=slow")