mirror of
https://github.com/LBRYFoundation/lbcd.git
synced 2025-08-31 01:11:30 +00:00
Fix GoLang CI
This commit is contained in:
parent
33ff9fb583
commit
ead4e4d6e8
2 changed files with 91 additions and 116 deletions
19
.github/workflows/golangci-lint.yml
vendored
19
.github/workflows/golangci-lint.yml
vendored
|
@ -35,23 +35,4 @@ jobs:
|
||||||
- name: golangci-lint
|
- name: golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v8
|
uses: golangci/golangci-lint-action@v8
|
||||||
with:
|
with:
|
||||||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
|
|
||||||
version: latest
|
version: latest
|
||||||
|
|
||||||
# Optional: working directory, useful for monorepos
|
|
||||||
# working-directory: somedir
|
|
||||||
|
|
||||||
# Optional: golangci-lint command line arguments.
|
|
||||||
# args: --issues-exit-code=0
|
|
||||||
|
|
||||||
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
|
||||||
# only-new-issues: true
|
|
||||||
|
|
||||||
# Optional: if set to true then the action will use pre-installed Go.
|
|
||||||
skip-go-installation: true
|
|
||||||
|
|
||||||
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
|
|
||||||
# skip-pkg-cache: true
|
|
||||||
|
|
||||||
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
|
|
||||||
# skip-build-cache: true
|
|
||||||
|
|
186
.golangci.yml
186
.golangci.yml
|
@ -1,71 +1,14 @@
|
||||||
linters-settings:
|
formatters:
|
||||||
depguard:
|
settings:
|
||||||
list-type: blacklist
|
gci:
|
||||||
packages:
|
sections:
|
||||||
# logging is allowed only by logutils.Log, logrus
|
- prefix(github.com/golangci/golangci-lint)
|
||||||
# is allowed to use only in logutils package
|
goimports:
|
||||||
- github.com/sirupsen/logrus
|
local-prefixes:
|
||||||
packages-with-error-message:
|
- github.com/golangci/golangci-lint
|
||||||
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
|
|
||||||
dupl:
|
|
||||||
threshold: 100
|
|
||||||
funlen:
|
|
||||||
lines: 100
|
|
||||||
statements: 50
|
|
||||||
gci:
|
|
||||||
local-prefixes: github.com/golangci/golangci-lint
|
|
||||||
goconst:
|
|
||||||
min-len: 2
|
|
||||||
min-occurrences: 2
|
|
||||||
gocritic:
|
|
||||||
enabled-tags:
|
|
||||||
- diagnostic
|
|
||||||
- experimental
|
|
||||||
- opinionated
|
|
||||||
- performance
|
|
||||||
- style
|
|
||||||
disabled-checks:
|
|
||||||
- dupImport # https://github.com/go-critic/go-critic/issues/845
|
|
||||||
- ifElseChain
|
|
||||||
- octalLiteral
|
|
||||||
- whyNoLint
|
|
||||||
- wrapperFunc
|
|
||||||
gocyclo:
|
|
||||||
min-complexity: 15
|
|
||||||
goimports:
|
|
||||||
local-prefixes: github.com/golangci/golangci-lint
|
|
||||||
gomnd:
|
|
||||||
settings:
|
|
||||||
mnd:
|
|
||||||
# don't include the "operation" and "assign"
|
|
||||||
checks:
|
|
||||||
- argument
|
|
||||||
- case
|
|
||||||
- condition
|
|
||||||
- return
|
|
||||||
govet:
|
|
||||||
check-shadowing: true
|
|
||||||
settings:
|
|
||||||
printf:
|
|
||||||
funcs:
|
|
||||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
|
|
||||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
|
|
||||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
|
|
||||||
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
|
|
||||||
lll:
|
|
||||||
line-length: 140
|
|
||||||
maligned:
|
|
||||||
suggest-new: true
|
|
||||||
misspell:
|
|
||||||
locale: US
|
|
||||||
nolintlint:
|
|
||||||
allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space)
|
|
||||||
allow-unused: false # report any unused nolint directives
|
|
||||||
require-explanation: false # don't require an explanation for nolint directives
|
|
||||||
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
|
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
default: none
|
||||||
enable:
|
enable:
|
||||||
- asciicheck
|
- asciicheck
|
||||||
- bodyclose
|
- bodyclose
|
||||||
|
@ -117,36 +60,87 @@ linters:
|
||||||
# - varcheck
|
# - varcheck
|
||||||
# - whitespace
|
# - whitespace
|
||||||
# - wsl
|
# - wsl
|
||||||
|
exclusions:
|
||||||
|
paths:
|
||||||
|
- test/testdata_etc
|
||||||
|
- internal/cache
|
||||||
|
- internal/renameio
|
||||||
|
- internal/robustio
|
||||||
|
rules:
|
||||||
|
- path: _test\.go
|
||||||
|
linters:
|
||||||
|
- gomnd
|
||||||
|
- path: pkg/golinters/errcheck.go
|
||||||
|
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
|
||||||
|
- path: pkg/commands/run.go
|
||||||
|
text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead"
|
||||||
|
|
||||||
issues:
|
# TODO must be removed after the release of the next version (v1.41.0)
|
||||||
# Excluding configuration per-path, per-linter, per-text and per-source
|
- path: pkg/commands/run.go
|
||||||
exclude-rules:
|
linters:
|
||||||
- path: _test\.go
|
|
||||||
linters:
|
|
||||||
- gomnd
|
- gomnd
|
||||||
|
# TODO must be removed after the release of the next version (v1.41.0)
|
||||||
|
- path: pkg/golinters/nolintlint/nolintlint.go
|
||||||
|
linters:
|
||||||
|
- gomnd
|
||||||
|
# TODO must be removed after the release of the next version (v1.41.0)
|
||||||
|
- path: pkg/printers/tab.go
|
||||||
|
linters:
|
||||||
|
- gomnd
|
||||||
|
settings:
|
||||||
|
govet:
|
||||||
|
enable:
|
||||||
|
- shadow
|
||||||
|
settings:
|
||||||
|
printf:
|
||||||
|
funcs:
|
||||||
|
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
|
||||||
|
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
|
||||||
|
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
|
||||||
|
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf
|
||||||
|
lll:
|
||||||
|
line-length: 140
|
||||||
|
depguard:
|
||||||
|
rules:
|
||||||
|
main:
|
||||||
|
list-mode: strict
|
||||||
|
deny:
|
||||||
|
- pkg: github.com/sirupsen/logrus
|
||||||
|
desc: "logging is allowed only by logutils.Log"
|
||||||
|
dupl:
|
||||||
|
threshold: 100
|
||||||
|
funlen:
|
||||||
|
lines: 100
|
||||||
|
statements: 50
|
||||||
|
goconst:
|
||||||
|
min-len: 2
|
||||||
|
min-occurrences: 2
|
||||||
|
gocritic:
|
||||||
|
enabled-tags:
|
||||||
|
- diagnostic
|
||||||
|
- experimental
|
||||||
|
- opinionated
|
||||||
|
- performance
|
||||||
|
- style
|
||||||
|
disabled-checks:
|
||||||
|
- dupImport # https://github.com/go-critic/go-critic/issues/845
|
||||||
|
- ifElseChain
|
||||||
|
- octalLiteral
|
||||||
|
- whyNoLint
|
||||||
|
- wrapperFunc
|
||||||
|
gocyclo:
|
||||||
|
min-complexity: 15
|
||||||
|
misspell:
|
||||||
|
locale: US
|
||||||
|
mnd:
|
||||||
|
checks:
|
||||||
|
- argument
|
||||||
|
- case
|
||||||
|
- condition
|
||||||
|
- return
|
||||||
|
nolintlint:
|
||||||
|
allow-unused: false # report any unused nolint directives
|
||||||
|
require-explanation: false # don't require an explanation for nolint directives
|
||||||
|
require-specific: false # don't require nolint directives to be specific about which linter is being skipped
|
||||||
|
|
||||||
- path: pkg/golinters/errcheck.go
|
version: "2"
|
||||||
text: "SA1019: errCfg.Exclude is deprecated: use ExcludeFunctions instead"
|
|
||||||
- path: pkg/commands/run.go
|
|
||||||
text: "SA1019: lsc.Errcheck.Exclude is deprecated: use ExcludeFunctions instead"
|
|
||||||
|
|
||||||
# TODO must be removed after the release of the next version (v1.41.0)
|
|
||||||
- path: pkg/commands/run.go
|
|
||||||
linters:
|
|
||||||
- gomnd
|
|
||||||
# TODO must be removed after the release of the next version (v1.41.0)
|
|
||||||
- path: pkg/golinters/nolintlint/nolintlint.go
|
|
||||||
linters:
|
|
||||||
- gomnd
|
|
||||||
# TODO must be removed after the release of the next version (v1.41.0)
|
|
||||||
- path: pkg/printers/tab.go
|
|
||||||
linters:
|
|
||||||
- gomnd
|
|
||||||
|
|
||||||
|
|
||||||
run:
|
|
||||||
skip-dirs:
|
|
||||||
- test/testdata_etc
|
|
||||||
- internal/cache
|
|
||||||
- internal/renameio
|
|
||||||
- internal/robustio
|
|
Loading…
Add table
Reference in a new issue