137 Commits

Author SHA1 Message Date
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
tdakkota
92aa97e55e feat: add asciicheck linter support 2020-04-22 19:55:05 +03:00
Marat Reymers
9914737fc3 Add linter testpackage 2020-04-22 18:57:30 +03:00
Ryan Currah
990b43f19a
Merge remote-tracking branch 'golangci/master' into add-gomodguard-linter 2020-04-21 20:17:09 -04:00
nakabonne
0108387c24 Add nestif linter 2020-04-22 08:51:43 +09:00
Ryan Currah
020b9e7103
added new linter gomodguard, disabled by default 2020-04-04 15:29:11 -04:00
Denis Krivak
58572c7789 Add new linter: godot 2020-03-16 11:56:57 +03:00
Aleksandr Razumov
517f7e5f63
Merge pull request #983 from markus-wa/master
deps: upgrade mnd from v1.1.1 to 2.0.0
2020-03-12 20:08:05 +03:00
Markus Walther
cea7e67040
deps: upgrade mnd from v1.1.1 to 2.0.0 2020-03-10 21:08:28 +00:00
Sebastiaan van Stijn
bf27481efd
update staticcheck to v2020.1.3
full diff: https://github.com/dominikh/go-tools/compare/2019.2.3...2020.1.3

Also updates tests to accomodate updated rules:

    --- FAIL: TestSourcesFromTestdataWithIssuesDir/staticcheck.go (0.43s)
            linters_test.go:137: [run --disable-all --print-issued-lines=false --print-linter-name=false --out-format=line-number --max-same-issues=10 -Estaticcheck --no-config testdata/staticcheck.go]
            linters_test.go:33:
                    Error Trace:    linters_test.go:33
                                                linters_test.go:138
                                                linters_test.go:53
                    Error:          Received unexpected error:

                                    staticcheck.go:11: no match for `self-assignment of x to x` vs ["SA4006: this value of `x` is never used"] in:
                                        staticcheck.go:11:2: SA4006: this value of `x` is never used
                                    unmatched errors
                                    staticcheck.go:11:2: SA4006: this value of `x` is never used
                    Test:           TestSourcesFromTestdataWithIssuesDir/staticcheck.go

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-03-10 14:55:19 +01:00
Daniel Helfand
a999403d3a change increase to increasing in timeout error 2020-02-18 11:42:58 -05:00
Eric Wohltman
cc8b9101d6 Fix test failure from gomnd 2020-01-20 09:37:58 -05:00
Isaev Denis
6237e59c97
dev: use goprintffuncname, gomnd and rowserrcheck (#927)
Order linters in config in alphabetical order.
Support gomnd configuration.
2020-01-19 19:55:29 +03:00
Isaev Denis
5f1096cf80
add goprintffuncname linter (#850) 2020-01-19 16:46:51 +03:00
gaojingyu
e93138f00f Add rows.Err weather checked linter (#849)
Add rowserrcheck

Co-authored-by: Isaev Denis <idenx@yandex.com>
2020-01-08 14:08:16 +03:00
David Braley
be3c688da4 I473 (#841)
Support custom linters integration by plugins

Co-authored-by: Isaev Denis <idenx@yandex.com>
2020-01-08 13:51:55 +03:00
sayboras
bd2921655a Added go-mnd linter (#842)
* Initial commit

* Fixed goimports

* Update pkg/golinters/mnd.go

Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>

* Run goimports

* Update pkg/golinters/mnd.go

Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>

* Add prefix for goimport local

* Run make README.md

* Incorporate review comments
Add test cases

* Update readme

* Update the description

* Removed subpath in local-prefixes

* Update readme
2019-11-15 19:08:43 -05:00
Simon Sawert
0e5b7a04d5 Bump wsl to v2.0.0 2019-11-15 18:55:54 -05:00
Simon Sawert
8c1e2f004e Revert "Bump wsl to v1.2.7"
This reverts commit 14ebae29060f7c7be67d31a559986aa8afe7cbb0.
2019-11-15 18:55:54 -05:00
Simon Sawert
14ebae2906 Bump wsl to v1.2.7 2019-11-10 19:07:16 -05:00
sayboras
93c0eebfa1 Fixed test deadline unit test 2019-11-07 17:22:13 -05:00
Daniel Caballero
98f60ebaa3 deadline is now deprecated, but should be taking its value from the configuration if set (#822)
* test that demostrates that deadline is not working if comes from the config

* overriding timeout with deadline when only deadline is different from its default value

* tests were not passing. default value for Deadline, that now only comes from config, is 0. Plus static check is going to fail because of deprecated cfg used

* golangci should use the latest golangci-lint version, that is the one deprecating deadline in favour of timeout

* README updated - looks the ci config in this project is used to generate usage instructions.. great!
2019-10-15 14:11:14 +03:00
Simon Sawert
22df2d739f Update WSL to v1.2.5 (#811)
* Update WSL to v1.2.4

* Fix false positive multiline case
* Fix false positive slice expression
* Fix false positive index expression
* Support to configure/allow cuddle declarations
* Support to configurre/allow case blocks to end with whitespace
* Support cuddle defer http body close

* Re-generate README.md

* Update WSL to v1.2.5

* Support output comments for example functions

* Fix bad field tag for config
2019-10-14 22:50:34 +03:00