commit e37ce02e6bf37464928e937fc4c8ef11d2b153b4 Author: Amolith Date: Sat Dec 20 11:16:26 2025 -0700 build(tooling): add crush/golangci-lint configs diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000000000000000000000000000000000000..8b2211705bdb808e7b00736ec45aaae5971735c1 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,153 @@ +# SPDX-FileCopyrightText: Amolith +# +# SPDX-License-Identifier: CC0-1.0 + +version: "2" +linters: + default: none + # Be specific + enable: + - arangolint + - asasalint + - asciicheck + - bidichk + - bodyclose + - canonicalheader + - containedctx + - contextcheck + - copyloopvar + - cyclop + - decorder + - dogsled + - dupl + - dupword + - durationcheck + - embeddedstructfieldcheck + - err113 + - errcheck + - errchkjson + - errname + - errorlint + - exhaustive + - exptostd + - fatcontext + - forbidigo + - forcetypeassert + - funcorder + - funlen + - ginkgolinter + - gocheckcompilerdirectives + - gochecknoglobals + - gochecknoinits + - gochecksumtype + - gocognit + - goconst + - gocritic + - gocyclo + - godoclint + - godot + - godox + - goheader + - gomoddirectives + - gomodguard + - goprintffuncname + - gosec + - gosmopolitan + - govet + - grouper + - iface + - importas + - inamedparam + - ineffassign + - interfacebloat + - intrange + - iotamixing + - ireturn + - lll + - loggercheck + - maintidx + - makezero + - mirror + - misspell + - mnd + - musttag + - nakedret + - nestif + - nilerr + - nilnesserr + - nilnil + - nlreturn + - noctx + - nolintlint + - nonamedreturns + - nosprintfhostport + - paralleltest + - perfsprint + - prealloc + - predeclared + - promlinter + - protogetter + - reassign + - recvcheck + - revive + - rowserrcheck + - sloglint + - spancheck + - sqlclosecheck + - staticcheck + - tagalign + - tagliatelle + - testableexamples + - testifylint + - testpackage + - thelper + - tparallel + - unconvert + - unparam + - unqueryvet + - unused + - usestdlibvars + - usetesting + - varnamelen + - wastedassign + - whitespace + - wrapcheck + - wsl_v5 + - zerologlint + + disable: + - depguard + - noinlineerr + + settings: + tagliatelle: + case: + rules: + json: snake + varnamelen: + ignore-names: + - c # client + - f # file handle + - id # entity ID + - ok # boolean check + - db # database + - tx # transaction + - fn # function + + exclusions: + rules: + - path: cmd/ + linters: + - gochecknoglobals # Cobra commands are package-level vars + - gochecknoinits # Cobra uses init() for flag registration + - errcheck # Stub implementations print without checking + - godox # TODOs are intentional placeholders + - wrapcheck # CLI returns errors for display, wrapping adds noise + - mnd # Magic numbers in cobra.ExactArgs are clear in context + - path: cmd/ + text: unused-parameter # Cobra callback signatures can't be changed + - path: internal/ui/ + linters: + - gochecknoglobals # Style constants are package-level vars + - path: internal/config/ + text: "0o700" # Config directory permissions are intentional diff --git a/crush.json b/crush.json new file mode 100644 index 0000000000000000000000000000000000000000..83dce04aa9cd8af9ba7f8afbc62e72b432c0df76 --- /dev/null +++ b/crush.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://charm.land/crush.json", + "lsp": { + "gopls": { + "options": { + "gofumpt": true, + "codelenses": { + "gc_details": true, + "generate": true, + "run_govulncheck": true, + "test": true, + "tidy": true, + "upgrade_dependency": true + }, + "hints": { + "assignVariableTypes": true, + "compositeLiteralFields": true, + "compositeLiteralTypes": true, + "constantValues": true, + "functionTypeParameters": true, + "parameterNames": true, + "rangeVariableTypes": true + }, + "analyses": { + "nilness": true, + "unusedparams": true, + "unusedvariable": true, + "unusedwrite": true, + "useany": true + }, + "staticcheck": true, + "directoryFilters": ["-.git", "-node_modules"], + "semanticTokens": true + } + }, + "golangci-lint": { + "command": "golangci-lint-langserver", + "filetypes": ["go"], + "init_options": { + "command": [ + "golangci-lint", + "run", + "--output.json.path", + "stdout", + "--show-stats=false", + "--issues-exit-code=1" + ] + } + } + } +}