2020-09-09 20:37:03 +00:00
|
|
|
run:
|
|
|
|
timeout: 10m
|
2022-03-04 08:17:41 +00:00
|
|
|
# Enable checking the by default skipped "examples" dirs
|
|
|
|
skip-dirs:
|
|
|
|
- Godeps$
|
|
|
|
- builtin$
|
2023-01-30 22:32:41 +00:00
|
|
|
- node_modules
|
2023-01-30 22:02:59 +00:00
|
|
|
- testdata$
|
|
|
|
- third_party$
|
|
|
|
- vendor$
|
2022-03-04 08:17:41 +00:00
|
|
|
skip-dirs-use-default: false
|
2018-11-05 21:36:35 +00:00
|
|
|
linters:
|
|
|
|
enable-all: false
|
|
|
|
enable:
|
|
|
|
- errcheck
|
2023-01-11 20:52:51 +00:00
|
|
|
- prealloc
|
2023-03-03 16:36:39 +00:00
|
|
|
- gofumpt
|
2021-09-21 17:00:44 +00:00
|
|
|
- revive
|
2018-11-05 21:36:35 +00:00
|
|
|
- gosec
|
|
|
|
- govet
|
|
|
|
- ineffassign
|
|
|
|
- lll
|
|
|
|
- misspell
|
2023-01-06 01:10:56 +00:00
|
|
|
- nolintlint
|
2018-11-05 21:36:35 +00:00
|
|
|
- nakedret
|
|
|
|
- unconvert
|
2023-01-11 03:01:25 +00:00
|
|
|
- unused
|
2022-03-04 08:17:41 +00:00
|
|
|
- paralleltest
|
2023-01-06 01:10:56 +00:00
|
|
|
|
|
|
|
linters-settings:
|
2023-06-28 11:55:00 +00:00
|
|
|
nakedret:
|
|
|
|
# Make an issue if func has more lines of code than this setting, and it has naked returns.
|
|
|
|
# Default: 30
|
|
|
|
max-func-lines: 60
|
2023-01-06 01:10:56 +00:00
|
|
|
nolintlint:
|
|
|
|
# Some linter exclusions are added to generated or templated files
|
|
|
|
# pre-emptively.
|
|
|
|
# Don't complain about these.
|
|
|
|
allow-unused: true
|
2023-04-04 17:53:05 +00:00
|
|
|
govet:
|
2023-05-19 22:47:41 +00:00
|
|
|
enable:
|
|
|
|
- nilness
|
|
|
|
# Reject comparisons of reflect.Value with DeepEqual or '=='.
|
|
|
|
- reflectvaluecompare
|
|
|
|
# Reject sort.Slice calls with a non-slice argument.
|
|
|
|
- sortslice
|
|
|
|
# Detect write to struct/arrays by-value that aren't read again.
|
|
|
|
- unusedwrite
|
golangci-lint: Enable staticcheck
Remove staticcheck from the list of disabled linters.
It's enabled by default in golangci-lint.
This also fixes minor remaining staticcheck issues
that don't merit their own pull requests,
or opts out of those that cannot be fixed yet.
Notably, we're opting out of:
- Resource.Name is deprecated (#9469)
- github.com/golang/protobuf is deprecated (#11869)
- strings.Title has been deprecated (#11870)
Besides that, other issues addressed in this change are:
```
// all issues are in pkg
codegen/schema/docs_parser.go:103:4: SA4006: this value of `text` is never used (staticcheck)
codegen/schema/loader.go:253:3: SA9003: empty branch (staticcheck)
resource/deploy/step_executor.go:328:12: SA9003: empty branch (staticcheck)
resource/deploy/step_generator.go:141:10: SA9003: empty branch (staticcheck)
codegen/pcl/invoke.go:97:10: SA9003: empty branch (staticcheck)
codegen/hcl2/model/type_const.go:57:2: SA9003: empty branch (staticcheck)
codegen/hcl2/model/type_enum.go:99:9: SA4001: &*x will be simplified to x. It will not copy x. (staticcheck)
codegen/go/gen_test.go:399:19: SA4017: HasPrefix is a pure function but its return value is ignored (staticcheck)
```
Depends on #11857, #11858, #11859, #11860, #11862, #11865, #11866, #11867, #11868
Resolves #11808
2023-01-11 19:53:41 +00:00
|
|
|
|
|
|
|
issues:
|
2023-03-20 23:49:45 +00:00
|
|
|
exclude-rules:
|
|
|
|
# Don't warn on unused parameters.
|
|
|
|
# Parameter names are useful; replacing them with '_' is undesirable.
|
|
|
|
- linters: [revive]
|
|
|
|
text: 'unused-parameter: parameter \S+ seems to be unused, consider removing or renaming it as _'
|
|
|
|
|
2023-03-20 23:03:05 +00:00
|
|
|
# staticcheck already has smarter checks for empty blocks.
|
|
|
|
# revive's empty-block linter has false positives.
|
|
|
|
# For example, as of writing this, the following is not allowed.
|
|
|
|
# for foo() { }
|
|
|
|
- linters: [revive]
|
|
|
|
text: 'empty-block: this block is empty, you can remove it'
|
|
|
|
|
2023-03-20 23:39:42 +00:00
|
|
|
# We *frequently* use the term 'new' in the context of properties
|
|
|
|
# (new and old properties),
|
|
|
|
# and we rarely use the 'new' built-in function.
|
|
|
|
# It's fine to ignore these cases.
|
|
|
|
- linters: [revive]
|
|
|
|
text: 'redefines-builtin-id: redefinition of the built-in function new'
|
|
|
|
|
golangci-lint: Enable staticcheck
Remove staticcheck from the list of disabled linters.
It's enabled by default in golangci-lint.
This also fixes minor remaining staticcheck issues
that don't merit their own pull requests,
or opts out of those that cannot be fixed yet.
Notably, we're opting out of:
- Resource.Name is deprecated (#9469)
- github.com/golang/protobuf is deprecated (#11869)
- strings.Title has been deprecated (#11870)
Besides that, other issues addressed in this change are:
```
// all issues are in pkg
codegen/schema/docs_parser.go:103:4: SA4006: this value of `text` is never used (staticcheck)
codegen/schema/loader.go:253:3: SA9003: empty branch (staticcheck)
resource/deploy/step_executor.go:328:12: SA9003: empty branch (staticcheck)
resource/deploy/step_generator.go:141:10: SA9003: empty branch (staticcheck)
codegen/pcl/invoke.go:97:10: SA9003: empty branch (staticcheck)
codegen/hcl2/model/type_const.go:57:2: SA9003: empty branch (staticcheck)
codegen/hcl2/model/type_enum.go:99:9: SA4001: &*x will be simplified to x. It will not copy x. (staticcheck)
codegen/go/gen_test.go:399:19: SA4017: HasPrefix is a pure function but its return value is ignored (staticcheck)
```
Depends on #11857, #11858, #11859, #11860, #11862, #11865, #11866, #11867, #11868
Resolves #11808
2023-01-11 19:53:41 +00:00
|
|
|
exclude:
|
|
|
|
# https://github.com/pulumi/pulumi/issues/9469
|
|
|
|
- 'Name is deprecated: Name returns the variable or declaration name of the resource'
|
|
|
|
|
|
|
|
# https://github.com/pulumi/pulumi/issues/11869
|
|
|
|
- '"github.com/golang/protobuf/[\w/]+" is deprecated'
|
|
|
|
|
|
|
|
# https://github.com/pulumi/pulumi/issues/11870
|
|
|
|
- 'strings.Title has been deprecated'
|
2023-03-01 22:33:59 +00:00
|
|
|
|
|
|
|
# https://github.com/pulumi/pulumi/issues/12328
|
|
|
|
- 'deprecated: Please use types in:? cloud.google.com/go/logging/apiv2/loggingpb'
|