Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.63.4
GOLANGCI_LINT_VERSION: v2.4.0

jobs:

Expand Down
218 changes: 67 additions & 151 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,156 +1,72 @@
run:
timeout: 10m
skip-files: []

linters-settings:
govet:
shadow: false
gocyclo:
min-complexity: 12
maligned:
suggest-new: true
goconst:
min-len: 3
min-occurrences: 3
funlen:
lines: -1
statements: 50
misspell:
locale: US
depguard:
rules:
main:
files:
- $all
allow:
- $gostd
- github.com/traefik/yaegi
tagalign:
align: false
order:
- xml
- json
- yaml
- yml
- toml
- mapstructure
- url
godox:
keywords:
- FIXME
gocritic:
enabled-tags:
- diagnostic
- style
- performance
disabled-checks:
- paramTypeCombine # already handle by gofumpt.extra-rules
- whyNoLint # already handle by nonolint
- unnamedResult
- hugeParam
- sloppyReassign
- rangeValCopy
- octalLiteral
- ptrToRefParam
- appendAssign
- ruleguard
- httpNoBody
- exposedSyncMutex
- importShadow # TODO should be fixed
- commentedOutCode # TODO should be fixed
revive:
rules:
- name: struct-tag
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
disabled: true
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: package-comments
disabled: true
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
disabled: true
- name: unreachable-code
- name: redefines-builtin-id

version: "2"
linters:
enable-all: true
default: standard
enable:
- depguard
- goconst
- godot
- grouper
- misspell
- perfsprint
- thelper
- unconvert
- unparam
disable:
- lll
- gosec
- dupl
- prealloc
- gocyclo
- cyclop
- gochecknoinits
- gochecknoglobals
- wsl
- nlreturn
- godox
- funlen
- gocognit
- stylecheck
- mnd
- testpackage
- paralleltest
- tparallel
- err113
- wrapcheck
- nestif
- exhaustive
- exhaustruct
- forbidigo
- forcetypeassert
- varnamelen
- nonamedreturns
- nilnil
- maintidx
- dupword # false positives
- errorlint # TODO: enable after fixes
- errcheck # TODO: enable after fixes
- revive # TODO: enable after fixes
- fatcontext # TODO: enable after fixes
- gocritic # TODO: enable after fixes
- predeclared # TODO: enable after fixes
- recvcheck # TODO: enable after fixes

- errcheck
settings:
depguard:
rules:
main:
files:
- $all
allow:
- $gostd
- github.com/traefik/yaegi
goconst:
min-len: 3
min-occurrences: 3
misspell:
locale: US
staticcheck:
checks: ["all", "-ST1000", "-ST1023", "-QF1001", "-QF1008", "-QF1011"]
exclusions:
generated: lax
rules:
- linters:
- goconst
path: .+_test\.go
- path: .+_test\.go
text: 'var-declaration:'
- path: interp/interp.go
text: '`in` can be `io.Reader`'
- path: interp/interp.go
text: '`out` can be `io.Writer`'
- path: interp/interp.go
text: '`Panic` should conform to the `XxxError` format'
- linters:
- thelper
path: interp/interp_eval_test.go
- linters:
- containedctx
path: interp/debugger.go
- path: (.+)\.go$
text: fmt.Sprintf can be replaced with string
paths:
- third_party$
- builtin$
- examples$
issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
exclude:
- 'fmt.Sprintf can be replaced with string'
exclude-rules:
- path: .+_test\.go
linters:
- goconst
- path: .+_test\.go
text: 'var-declaration:'
- path: interp/interp.go
text: '`in` can be `io.Reader`'
- path: interp/interp.go
text: '`out` can be `io.Writer`'
- path: interp/interp.go
text: '`Panic` should conform to the `XxxError` format'
- path: interp/interp_eval_test.go
linters:
- thelper
- path: interp/debugger.go
linters:
- containedctx
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion cmd/yaegi/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func test(arg []string) (err error) {
tests := []testing.InternalTest{}
syms, ok := i.Symbols(path)[path]
if !ok {
return errors.New("No tests found")
return errors.New("no tests found")
}
for name, sym := range syms {
switch fun := sym.Interface().(type) {
Expand Down
2 changes: 1 addition & 1 deletion interp/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ func genFunctionWrapper(n *node) func(*frame) reflect.Value {
funcType := n.typ.TypeOf()

value := genValue(n)
isDefer := false
var isDefer bool
if n.anc != nil && n.anc.anc != nil && n.anc.anc.kind == deferStmt {
isDefer = true
}
Expand Down
5 changes: 1 addition & 4 deletions interp/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -1182,10 +1182,7 @@ func genMethod(interp *Interpreter, sc *scope, t *itype, nod *node, types []*ity
// findPackageType searches the top level scope for a package type.
func findPackageType(interp *Interpreter, sc *scope, n *node) *itype {
// Find the root scope, the package symbols will exist there.
for {
if sc.level == 0 {
break
}
for sc.level != 0 {
sc = sc.anc
}

Expand Down
Loading