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:
@@ -128,6 +128,7 @@ func namedKey(k tcell.Key) (byte, bool) {
|
||||
// motionKey translates the arrow and paging keys to Rogue's movement
|
||||
// letters (tcell.go ReadChar).
|
||||
func motionKey(k tcell.Key) (byte, bool) {
|
||||
//nolint:exhaustive // translation table: all other keys fall through
|
||||
switch k {
|
||||
case tcell.KeyUp:
|
||||
return 'k', true
|
||||
@@ -153,19 +154,20 @@ func motionKey(k tcell.Key) (byte, bool) {
|
||||
// editingKey translates the editing and control keys to their C0 codes
|
||||
// (tcell.go ReadChar).
|
||||
func editingKey(k tcell.Key) (byte, bool) {
|
||||
//nolint:exhaustive // translation table: all other keys fall through
|
||||
switch k {
|
||||
case tcell.KeyEnter:
|
||||
return '\n', true
|
||||
case tcell.KeyEscape:
|
||||
return game.Escape, true
|
||||
case tcell.KeyBackspace, tcell.KeyBackspace2:
|
||||
return 8, true
|
||||
return '\b', true
|
||||
case tcell.KeyDelete:
|
||||
return 0x7f, true
|
||||
return '\x7f', true
|
||||
case tcell.KeyTab:
|
||||
return '\t', true
|
||||
case tcell.KeyCtrlC:
|
||||
return 3, true
|
||||
return '\x03', true
|
||||
}
|
||||
|
||||
return 0, false
|
||||
@@ -188,8 +190,8 @@ func (t *Tcell) ShellEscape() {
|
||||
"[Entering shell; exit to return to the game]")
|
||||
|
||||
// The shell session has no deadline by design; Background context.
|
||||
cmd := exec.CommandContext(context.Background(), //nolint:gosec // G204: the user's own $SHELL
|
||||
shell)
|
||||
//nolint:gosec // G204: the user's own $SHELL
|
||||
cmd := exec.CommandContext(context.Background(), shell)
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
Reference in New Issue
Block a user