120 Commits

Author SHA1 Message Date
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
Isaev Denis
9ba730e989
Make incremental analysis (#808)
Cache linting results. Reanalyze only changed packages
and packages tree depending on them.

Fixes #768, fixes #809
2019-10-13 17:40:51 +03:00
Denis Titusov
0cc87df732 Rename deadline option to timeout and mark deadline as deprecated. (#793) 2019-10-08 09:37:54 +03:00
Trevor Pounds
ee2e17f7e9 Update to latest securego/gosec (#792)
* Update to latest securego/gosec.

* Fix gosec G204 warnings.

* Add gosec G204 test.
2019-10-08 09:36:21 +03:00
Simon Sawert
d4b4ad8dfe Update WSL to v1.2.1 (#794)
* Update WSL to v1.2.1

* Add new tests for fixed false positives, don't derive defaults from WSL
2019-10-07 21:22:44 -04:00
Simon Sawert
3e09174bd2 Add WSL linter (#771)
* Add WSL linter

* Use v1.0.0 tag for wsl

* Don't add specific test file skip, use mutex to add errors

* Fix goimports error

* Add more tests for WSL, bump WSL version

* Fix bad go.sum (go mod tidy)
2019-10-04 16:03:40 -04:00
Trevor Pounds
30864f8818 Add more gocognit tests. 2019-10-04 11:29:53 -04:00
NiseVoid
fbbd24575f Update whitespace to v0.0.4 (#786) 2019-10-04 15:12:07 +03:00
Nuruddin Ashr
92ec1a1f4c Add gocognit linter (#756)
* Add gocognit linter

* Remove gocognit to the golangci config

* Make changes on README.md

* Remove gocognit from megacheck benchtest

* Remove command line flags

* Comply with new style
2019-10-03 16:22:06 +03:00
Trevor Pounds
6d786b50ae Group imports by package. 2019-10-01 18:09:47 -04:00
Isaev Denis
95ec0cf21e
dramatically reduce memory usage (#758)
Run all linters per package. It allows unloading package data when it's
processed. It dramatically reduces memory (and CPU because of GC) usage.

Relates: #337
2019-09-30 16:19:41 +03:00
NiseVoid
9976bdcc5e Update whitespace 2019-09-23 12:16:06 -04:00
Denis Isaev
3aade55e05 Reduce memory usage of go/analysis 2019-09-23 09:52:54 +03:00
Trevor Pounds
a653032409 Fix flaky cgo test failures. (#716)
Fixes flaky cgo test failures caused by duplicate printf
format checks in staticcheck and go vet that use slightly
different reporting formats.
2019-09-20 19:05:01 +03:00
Trevor Pounds
92168d033d Add dogsled linter. (#705) 2019-09-17 08:44:53 +03:00
Isaev Denis
6a979fb40d
Update staticcheck and cache go/analysis facts (#699)
* update staticcheck

Don't fork staticcheck: use the upstream version.
Remove unneeded SSA loading.

* Cache go/analysis facts

Don't load unneeded packages for go/analysis.
Repeated run of go/analysis linters now 10x faster
(2s vs 20s on this repo) than before.
2019-09-17 08:42:16 +03:00
Isaev Denis
c9a9255238
Speed up packages loading (#693)
Don't perform extra go env calls in go/packages.
Load only needed go env vars in golangci-lint.
Stay in sync by enabled analyzers in go vet: remove nilness and
atomicalign analyzers, add errorsas analyzer.
Don't build SSA for govet.

Standalone govet runs 25% faster than before. All runs can be 5-10% faster
than before.
Relates: #208
2019-09-14 18:48:18 +03:00
Matouš Dzivjak
58845813da linters: add Godox linter support (#621)
Godox is linter for TODOs and FIXMEs left in the code.

Signed-off-by: Matous Dzivjak <matous.dzivjak@kiwi.com>
2019-09-11 16:53:40 +03:00