359 Commits

Author SHA1 Message Date
Andrew Shannon Brown
ec46f42e01
Verify linter name in integration tests (#1595) 2021-01-15 21:37:56 +01:00
Ludovic Fernandez
44bf1977a0
fix regression: update thelper to v0.2.1 (#1639)
Some checks failed
Extra / Vulnerability scanner (push) Failing after 1m54s
CI / go-mod (push) Failing after 17m16s
CI / golangci-lint (push) Failing after 17m14s
Release a tag / release (push) Failing after 17m12s
CI / tests-on-windows (push) Has been cancelled
CI / tests-on-macos (push) Has been cancelled
CI / tests-on-unix (1.13) (push) Has been cancelled
CI / tests-on-unix (1.14) (push) Has been cancelled
CI / tests-on-unix (1.15) (push) Has been cancelled
CI / check_generated (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/Dockerfile.alpine]) (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/Dockerfile]) (push) Has been cancelled
2021-01-09 20:21:31 +01:00
Ludovic Fernandez
e5a395b2c8
Update mvdan.cc/gofumpt to v0.1.0 (#1637) 2021-01-08 16:48:56 +01:00
Nishanth Shanmugham
76c452197b
add 'predeclared' linter (#1606) 2021-01-07 17:58:04 +01:00
Andrew Shannon Brown
306816ec85
Revert "Update nolintlint to fix nolint formatting and remove unused nolint statements (#1573)" (#1584)
This reverts commit aeb98303293570ba682ea933a4e9501a11a3aa99.

There are some cases that nolinter fixer wasn't handling properly or expectedly (#1579, #1580, #1581) so we'll fix those in a new attempt.
2020-12-27 11:49:58 -08:00
Andrew Shannon Brown
aeb9830329
Update nolintlint to fix nolint formatting and remove unused nolint statements (#1573)
Also allow multiple ranges to satisfy a nolint statement as having been used.
2020-12-27 06:18:02 -08:00
Andrew Shannon Brown
222076fdc6
Add forbidigo linter (#1569) 2020-12-24 17:19:32 +01:00
Ludovic Fernandez
be0297933a
fix: nolintlint comment analysis. (#1571) 2020-12-22 01:24:28 +01:00
Aleksey Bakin
0370d3adea
Add thelper linter (#1541) 2020-12-13 14:54:26 +01:00
Andrew Shannon Brown
cf32a7b706
Add makezero linter (#1520)
makezero ensures that objects recognized as slices are initialized with length 0.  By default, this is only required when we find a subsequent append to the object, but can also be enabled at all times as a way of discouraging the use of integer variables (i.e. "i") to index slices.
2020-12-05 07:37:37 -08:00
Kunwardeep
b90551cdf9
add new paralleltest linter (#1503)
Some checks failed
Extra / Vulnerability scanner (push) Failing after 15m24s
CI / go-mod (push) Failing after 15m22s
CI / golangci-lint (push) Failing after 15m20s
Release a tag / release (push) Failing after 15m18s
CI / tests-on-windows (push) Has been cancelled
CI / tests-on-macos (push) Has been cancelled
CI / tests-on-unix (1.13) (push) Has been cancelled
CI / tests-on-unix (1.14) (push) Has been cancelled
CI / tests-on-unix (1.15) (push) Has been cancelled
CI / check_generated (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/Dockerfile.alpine]) (push) Has been cancelled
Release a tag / docker-release (map[Dockerfile:build/Dockerfile]) (push) Has been cancelled
2020-11-22 22:28:38 +03:00
iwankgb
993337baa2
Using upstrem goconst (#1500)
github.com/golangci/goconst is now obsolete :)
2020-11-17 19:07:37 +00:00
ZhangYunHao
9948153575
DefaultExcludePatterns should only be used for specified linter (#1494)
Co-authored-by: zhangyunhao <zhangyunhao@bytedance.com>
2020-11-12 15:21:19 +01:00
Denis Krivak
df2e9e2ebd
Update godot to 1.3.0 (#1498) 2020-11-10 20:11:26 +03:00
Mateusz Bilski
55e35d27e3
Update exhaustivestruct (#1472)
* Update exhaustivestruct

* Add tests
2020-10-27 00:54:55 +01:00
Simon Sawert
a8b7b0037a
Update gochecknoglobals, use source analyzer (#1422) 2020-10-16 08:38:04 +11:00
nishanths
58234f055c
update exhaustive to latest; use version in go.mod (#1449)
* update exhaustive to latest

* wip

* update dep

* update flag name

* use versioned dep

* add tests

* unused file

* no need config file

* add vars to test

* test comment

* remove default settings
2020-10-14 08:19:06 +02:00
Mateusz Bilski
c57627b18c
Add exhaustivestruct linter (#1411)
* Add exhaustivestruct linter

* CHange load mode to types info

* Fix go.mod
2020-10-12 08:35:02 +02:00
Vladimir Evgrafov
796a958805
Add go-errorlint (#1420)
* Add errorlint

* Add errorlint config example
2020-10-09 15:42:48 +03:00
Tom Arrell
247b6c2796
Add wrapcheck linter (#1407)
* Add failing test

* Add wrapcheck linter
2020-10-06 13:40:00 +02:00
Melvin
926e76dcf2
Add tparallel linter (#1380) 2020-10-02 13:00:46 -07:00
Xiang Dai
913e57fcda
Gci: update the way to call Run() (#1337)
Signed-off-by: Xiang Dai <long0dai@foxmail.com>
2020-08-31 08:38:05 +08:00
Tam Mach
18fd36bdd1
build(golang1.15): Upgrade to golang 1.15 for smaller binary (#1303)
Golang 1.15 comes to few improvements, one of them is to have smaller
binary.

This PR is to make golang 1.15 as default version in CI, I also update
Docker based image to golang:1.15* as well.

Two issues faced with golang 1.15:
- Conflict between -v in `golangci-lint` and `go test`. Update to --verbose
to avoid the same. [1]
- `nolintlint_unused.go` testdata is not matching regex. Correct by adding one
space after //

[1]: https://github.com/golang/go/issues/40763

Signed-off-by: Tam Mach <sayboras@yahoo.com>
2020-08-19 09:05:32 +10:00
Grigory Zubankov
6b60cb8a30
new nlreturn linter (#1267)
* new nlreturn linter

* fix: import order

Co-authored-by: Sergey Vilgelm <sergey.vilgelm@ibm.com>
2020-08-02 15:16:45 -05:00
dependabot[bot]
4354a648ed
build(deps): bump github.com/securego/gosec/v2 from 2.3.0 to 2.4.0 (#1273)
* build(deps): bump github.com/securego/gosec/v2 from 2.3.0 to 2.4.0

Bumps [github.com/securego/gosec/v2](https://github.com/securego/gosec) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/securego/gosec/releases)
- [Changelog](https://github.com/securego/gosec/blob/master/.goreleaser.yml)
- [Commits](https://github.com/securego/gosec/compare/v2.3.0...v2.4.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Rename Blacklisted -> Blocklisted

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sergey Vilgelm <sergey.vilgelm@ibm.com>
2020-08-02 14:48:26 -05:00
Xiang Dai
60613dc3eb
Introduce gci as new linter (#1266)
* Introduce gci as new linter

Signed-off-by: Xiang Dai <long0dai@foxmail.com>

* use goimports setting if not specified

Signed-off-by: Xiang Dai <long0dai@foxmail.com>
2020-07-28 13:55:02 +03:00
Sergey Vilgelm
c8bd9549a5
Support --fix for gofumpt (#1239) 2020-07-18 21:33:47 -05:00
Oleg Butuzov
6e7c317610
Sorting result.Issues implementation (golangci/golangci-lint#1217) (#1218) 2020-07-12 16:35:08 -05:00
Joe Wilner
60abe4ab6a
Use lowercase directories (#1229) 2020-07-10 22:09:01 -05:00
Joe Wilner
6550984878
Configure path prefix via processor abstraction (#1226) 2020-07-11 09:14:52 +10:00
Denis Tingaikin
dfa0013583
Fix: goheader linter can throw nil pointer exception in case of a source file has not issues (#1209)
* fix potential nil pointer exception

Signed-off-by: denis-tingajkin <denis.tingajkin@xored.com>

* add test to cover

Signed-off-by: denis-tingajkin <denis.tingajkin@xored.com>
2020-07-05 15:32:00 +07:00
iwankgb
306cbb0e6e
Upgrading to go-critic v0.5.0 (#1205)
Some checks failed
CI / golangci-lint (push) Failing after 3m54s
CI / tests-on-windows (push) Has been skipped
CI / tests-on-unix (1.13, ubuntu-latest) (push) Has been skipped
CI / tests-on-unix (1.14, ubuntu-latest) (push) Has been skipped
CI / check_generated (push) Has been skipped
Release a tag / release (push) Failing after 4m22s
2020-07-04 20:07:26 +00:00
Denis Tingaikin
01b566a646
Add go-header linter (#1181)
* add go-header linter
* apply review comments: add goheader example into .golangci.example.yml
* apply review comments: correctly handle multiline comments
2020-07-04 19:03:37 +00:00
Ryan Olds
b22e3f1874
Added sqlclosecheck to linters (#1203)
* Added sqlclosecheck to linters
* Addressed feedback
* Updated sqlclosecheck and tools
2020-07-04 14:30:16 +00:00
Teiva Harsanyi
38d298c2c8
Adding gofumpt (#1177) 2020-06-16 13:05:28 +03:00
sonata
f1a46f9861
Add Noctx (#1179)
Support for linter that enforces using context on each `http.Request`
https://github.com/sonatard/noctx
2020-06-08 20:21:58 +00:00
Nishanth Shanmugham
f3376cab71
add exhaustive linter (#1166)
* wip

more

add new files

run command fixes

more

* go.mod

* order

* same package

* review comment

* enable linter in .golangci.yml

* add testcase for default-signifies-exhaustive: true

* adjust runGoErrchk instead

* disable the linter

* cleanup

* more cleanup

* cleanup
2020-05-29 16:31:46 +03:00
Tam Mach
dc260be693
Add exportloopref linter (#1163) 2020-05-24 10:31:32 +03:00
Denis Krivak
7c2871c596
godot: add autofix mode 2020-05-18 15:49:58 +03:00
Isaev Denis
6b124f1a0e
fix goerr13 dependencies (#1089) 2020-05-13 21:22:52 +03:00
Collin Kreklow
3c2aa58dc5
Add *println to exception EXC0001 (#1074)
Exception EXC0001 ignores errors on functions like Sprint and Sprintf,
but not Sprintln. Update the exception to include *println as well.
2020-05-09 15:18:17 +03:00
Isaev Denis
cb58d1f82e
speed up CI and golangci-lint (#1070)
Run CI on mac os only with go1.13 and on windows only on go1.14.
Speed up tests. Introduce --allow-parallel-runners.
Block on parallel run lock 5s instead of 60s.
Don't invalidate analysis cache for minor config changes.
2020-05-09 15:15:34 +03:00
Soichiro Kashima
7f48cc88b8
Fix lint errors on files with //line directive (#1065)
If the target files contains `//line` directive and it indicates
a non-go file, the linter is going to handle it as a go file,
which results in failure.
The cause of this issue is that the linters (`Analyzer`s) are using
`pass.Fset.Position()`. This func returns the adjusted position using
`//line` directive.
The example project reported in #998 has `//line` directive that
indicates other non-go file.
According to the description of "Compiler Directives”
(https://golang.org/cmd/compile/#hdr-Compiler_Directives),
line directives is mainly used for reporting original positions to
the generators or something.
On linters of golangci-lint, `pass.Fset.Position()` is used just to
aggregate file names; we don't have to adjust positions.
This changes `Analyzer`s that use `pass.Fset.Position()` to aggregate
file names to use `pass.Fset.PositionFor()` with `adjusted == false`.

Relates: #998
2020-05-05 18:49:34 +03:00
Andrew Shannon Brown
ef44e11e17
Merge branch 'master' into asb/nolintlint-internal 2020-04-29 15:27:35 -07:00
tdakkota
0d95fafefc feat: add go-err113 linter support 2020-04-27 21:37:34 +03:00
Aleksandr Razumov
1353b60074
test: add unused testdata for fix 2020-04-27 19:19:12 +03:00
Andrew Shannon Brown
909f628d75 Add linter for nolint
Linter can check that nolint statements are properly formatted and also that all
nolint statements are used.
2020-04-26 20:20:17 -07:00
Aleksandr Razumov
1373897abf
Merge branch 'tdakkota-feature/add-asciicheck-support' 2020-04-25 17:51:53 +03:00
Aleksandr Razumov
6db0292426
mod: downgrade honnef.co/go/tools to v2019.2.3
Hotfix for `failed prerequisites` errors.
Actual cause is still unknown.

Revert: #987
Ref: #994, #995, #1011
2020-04-23 01:16:55 +03:00
Aleksandr Razumov
d00692c355
Merge branch 'nestif' of https://github.com/nakabonne/golangci-lint into nakabonne-nestif 2020-04-23 00:31:25 +03:00