2019-07-22 11:05:57 +02:00
|
|
|
run:
|
|
|
|
# timeout for analysis
|
2020-09-04 14:10:03 +02:00
|
|
|
deadline: 10m
|
2019-09-11 14:21:04 +02:00
|
|
|
|
2021-07-27 13:00:00 +02:00
|
|
|
# Skip autogenerated files for mobile and gRPC.
|
2019-09-17 15:21:31 +02:00
|
|
|
skip-files:
|
|
|
|
- "mobile\\/.*generated\\.go"
|
2021-07-27 13:00:00 +02:00
|
|
|
- "\\.pb\\.go$"
|
|
|
|
- "\\.pb\\.gw\\.go$"
|
2019-09-17 15:21:31 +02:00
|
|
|
|
2019-10-24 12:04:26 +02:00
|
|
|
skip-dirs:
|
|
|
|
- channeldb/migration_01_to_11
|
2021-01-15 11:12:08 +01:00
|
|
|
- channeldb/migration/lnwire21
|
2019-10-24 12:04:26 +02:00
|
|
|
|
2019-09-10 12:35:31 +02:00
|
|
|
build-tags:
|
|
|
|
- autopilotrpc
|
|
|
|
- chainrpc
|
2022-01-24 17:42:14 +01:00
|
|
|
- dev
|
2019-09-10 12:35:31 +02:00
|
|
|
- invoicesrpc
|
2021-08-23 04:59:06 +02:00
|
|
|
- neutrinorpc
|
2021-12-06 05:24:06 +01:00
|
|
|
- peersrpc
|
2019-09-10 12:35:31 +02:00
|
|
|
- signrpc
|
|
|
|
- walletrpc
|
|
|
|
- watchtowerrpc
|
2022-02-07 13:58:24 +01:00
|
|
|
- kvdb_etcd
|
|
|
|
- kvdb_postgres
|
2019-07-22 11:05:57 +02:00
|
|
|
|
|
|
|
linters-settings:
|
|
|
|
govet:
|
|
|
|
# Don't report about shadowed variables
|
|
|
|
check-shadowing: false
|
|
|
|
gofmt:
|
|
|
|
# simplify code: gofmt with `-s` option, true by default
|
|
|
|
simplify: true
|
2022-02-07 13:58:24 +01:00
|
|
|
tagliatelle:
|
|
|
|
case:
|
|
|
|
rules:
|
|
|
|
json: snake
|
|
|
|
whitespace:
|
|
|
|
multi-func: true
|
|
|
|
multi-if: true
|
|
|
|
gosec:
|
|
|
|
excludes:
|
|
|
|
- G402 # Look for bad TLS connection settings.
|
|
|
|
- G306 # Poor file permissions used when writing to a new file.
|
|
|
|
staticcheck:
|
2022-04-27 22:20:30 +02:00
|
|
|
go: "1.18"
|
2022-02-07 13:58:24 +01:00
|
|
|
checks: ["-SA1019"]
|
2019-07-22 11:05:57 +02:00
|
|
|
|
|
|
|
linters:
|
2019-09-11 14:21:04 +02:00
|
|
|
enable-all: true
|
|
|
|
disable:
|
|
|
|
# Global variables are used in many places throughout the code base.
|
|
|
|
- gochecknoglobals
|
|
|
|
|
|
|
|
# Some lines are over 80 characters on purpose and we don't want to make them
|
|
|
|
# even longer by marking them as 'nolint'.
|
|
|
|
- lll
|
|
|
|
|
2022-02-07 13:58:24 +01:00
|
|
|
# We want to allow short variable names.
|
|
|
|
- varnamelen
|
|
|
|
|
|
|
|
# We want to allow TODOs.
|
|
|
|
- godox
|
2019-09-11 14:21:04 +02:00
|
|
|
|
2019-09-13 11:15:43 +02:00
|
|
|
# We have long functions, especially in tests. Moving or renaming those would
|
|
|
|
# trigger funlen problems that we may not want to solve at that time.
|
|
|
|
- funlen
|
|
|
|
|
2019-09-17 05:46:01 +02:00
|
|
|
# Disable for now as we haven't yet tuned the sensitivity to our codebase
|
2022-02-07 13:58:24 +01:00
|
|
|
# yet. Enabling by default for example, would also force new contributors to
|
2019-09-17 05:46:01 +02:00
|
|
|
# potentially extensively refactor code, when they want to smaller change to
|
|
|
|
# land.
|
|
|
|
- gocyclo
|
2022-02-07 13:58:24 +01:00
|
|
|
- gocognit
|
|
|
|
- cyclop
|
2019-09-17 05:46:01 +02:00
|
|
|
|
|
|
|
# Instances of table driven tests that don't pre-allocate shouldn't trigger
|
|
|
|
# the linter.
|
|
|
|
- prealloc
|
|
|
|
|
2019-08-08 19:39:38 +02:00
|
|
|
# Init functions are used by loggers throughout the codebase.
|
|
|
|
- gochecknoinits
|
2022-02-07 13:58:24 +01:00
|
|
|
|
|
|
|
# Causes stack overflow, see https://github.com/polyfloyd/go-errorlint/issues/19.
|
|
|
|
- errorlint
|
2019-08-08 19:39:38 +02:00
|
|
|
|
2022-02-07 13:58:24 +01:00
|
|
|
# Deprecated linters. See https://golangci-lint.run/usage/linters/.
|
2021-12-13 15:32:23 +01:00
|
|
|
- interfacer
|
2022-02-07 13:58:24 +01:00
|
|
|
- golint
|
|
|
|
- maligned
|
|
|
|
- scopelint
|
|
|
|
|
|
|
|
# New linters that need a code adjustment first.
|
|
|
|
- wrapcheck
|
|
|
|
- nolintlint
|
|
|
|
- paralleltest
|
|
|
|
- tparallel
|
|
|
|
- testpackage
|
|
|
|
- gofumpt
|
|
|
|
- gomoddirectives
|
|
|
|
- ireturn
|
|
|
|
- maintidx
|
|
|
|
- nlreturn
|
|
|
|
- dogsled
|
|
|
|
- gci
|
|
|
|
- containedctx
|
|
|
|
- contextcheck
|
|
|
|
- errname
|
|
|
|
- exhaustivestruct
|
|
|
|
- goerr113
|
|
|
|
- gomnd
|
|
|
|
- ifshort
|
|
|
|
- noctx
|
|
|
|
- nestif
|
|
|
|
- wsl
|
|
|
|
- exhaustive
|
|
|
|
- forcetypeassert
|
|
|
|
- nilerr
|
|
|
|
- nilnil
|
|
|
|
- stylecheck
|
|
|
|
- thelper
|
2021-12-13 15:32:23 +01:00
|
|
|
|
2019-09-11 14:21:04 +02:00
|
|
|
issues:
|
|
|
|
# Only show newly introduced problems.
|
|
|
|
new-from-rev: 01f696afce2f9c0d4ed854edefa3846891d01d8a
|
2019-12-03 10:38:21 +01:00
|
|
|
|
|
|
|
exclude-rules:
|
|
|
|
# Exclude gosec from running for tests so that tests with weak randomness
|
|
|
|
# (math/rand) will pass the linter.
|
|
|
|
- path: _test\.go
|
|
|
|
linters:
|
|
|
|
- gosec
|
2022-02-07 13:58:24 +01:00
|
|
|
- path: test*
|
|
|
|
linters:
|
|
|
|
- gosec
|
|
|
|
|
|
|
|
# Allow duplicated code and fmt.Printf() in DB migrations.
|
|
|
|
- path: channeldb/migration*
|
|
|
|
linters:
|
|
|
|
- dupl
|
|
|
|
- forbidigo
|
|
|
|
- godot
|
|
|
|
|
|
|
|
# Allow duplicated code and fmt.Printf() in DB migration tests.
|
|
|
|
- path: channeldb/migtest
|
|
|
|
linters:
|
|
|
|
- dupl
|
|
|
|
- forbidigo
|
|
|
|
- godot
|
|
|
|
|
|
|
|
# Allow fmt.Printf() in lncli.
|
|
|
|
- path: cmd/lncli/*
|
|
|
|
linters:
|
|
|
|
- forbidigo
|
|
|
|
|
|
|
|
# Allow fmt.Printf() in config parsing.
|
|
|
|
- path: config\.go
|
|
|
|
linters:
|
|
|
|
- forbidigo
|
|
|
|
- path: lnd\.go
|
|
|
|
linters:
|
|
|
|
- forbidigo
|
2020-01-10 15:27:50 +01:00
|
|
|
|
|
|
|
# Fix false positives because of build flags in itest directory.
|
|
|
|
- path: lntest/itest/.*
|
|
|
|
linters:
|
|
|
|
- unused
|
|
|
|
- deadcode
|
|
|
|
- unparam
|
|
|
|
- govet
|