198 Commits

Author SHA1 Message Date
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
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
dependabot-preview[bot]
65e1b30ebd
build(deps): bump github.com/kyoh86/exportloopref from 0.1.4 to 0.1.7 (#1214)
* build(deps): bump github.com/kyoh86/exportloopref from 0.1.4 to 0.1.7

Bumps [github.com/kyoh86/exportloopref](https://github.com/kyoh86/exportloopref) from 0.1.4 to 0.1.7.
- [Release notes](https://github.com/kyoh86/exportloopref/releases)
- [Changelog](https://github.com/kyoh86/exportloopref/blob/master/.goreleaser.yml)
- [Commits](https://github.com/kyoh86/exportloopref/compare/v0.1.4...v0.1.7)

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

* Fix exportloopref linter

Change the WithLoadMode to use LoadModeTypesInfo isntead of LoadModeSyntax

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Sergey Vilgelm <sergey.vilgelm@ibm.com>
2020-07-12 21:41:06 +02:00
Melvin
ee86e0e893
gofumpt: Add extra-rules option + update linter (#1228)
Co-authored-by: Sergey Vilgelm <sergey.vilgelm@ibm.com>
2020-07-12 11:38:07 -05: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
Ryan Currah
778e08fda4
bump gomodguard version (#1140)
* bump gomodguard version which adds a new feature to allow blocking modules based on version constraints

* add description why you may want to use gomodguard over depguard, updated example config and add a section the contributor doc page to remind people to update the example config
2020-05-17 22:35:13 +03:00
Denis Krivak
d7648bf202 godot: fix issue with --fix flag 2020-05-13 11:39:08 +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
Isaev Denis
52c9b88c25
reduce mem. usage of unused and update staticcheck (#1063)
The primary improvement is in early clearing of
analyzed package's TypeInfo, facts, etc for
whole program analyzers (`unused`). Clear it when it
becomes unused and GC collects them early. Initially this
clearing was performed for all analyzers except `unused`.

Update staticcheck from v0.0.1-2019.2.3 to v0.0.1-2020.1.4

Also in this commit:
  * speed up loading packages from export data (2.5s -> 2.1s for std)
    by not using mutex for export data since it was allowed in
    x/tools#07722704da13
  * make an order of execution of linters stable
  * update renameio and robustio
  * use robustio in caching

Relates: #987, #994, #995, #1011
2020-05-03 15:20:17 +03:00
Tim Heckman
60fd647987
Update gosec linter to v2; add .test files to .gitignore (#1062)
This change updates the `gosec` linter to its v2 version. It seems like v2
maintained API compatibility for the functionality we use, so we only needed to
update the dependency and imports.

Please note, this does not use a tagged version of `gosec` and instead is the
latest `master` commit due to this issue: https://github.com/securego/gosec/issues/470.
Once this issue is resolved we should update `gosec` to a tagged release.

This also adds a line to the `.gitignore` file, to ignore the `.test` output
files that get generated by `go test`. This could accidentally get left behind,
so no use committing binary files.

Fixes #1052
2020-05-03 14:05:00 +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
3deb9d80ab
unused: check line range before suggesting fix
Fix #1048
2020-04-27 19:59:38 +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
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
9442a4132c Use sort.SliceStable instead of sort.Slice 2020-04-22 08:53:50 +09:00
nakabonne
0108387c24 Add nestif linter 2020-04-22 08:51:43 +09:00
Ryan Currah
4292963937
do not error out when go.mod is missing just raise warning, change linter options 2020-04-05 17:49:27 -04: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
Simon Sawert
4a2147930a
Update wsl to v3.0.0
* Support to force cuddle with error checking
* Support to separate leading comments with empty lines
2020-03-15 13:36:57 +01:00
Aleksandr Razumov
e4643439b3
goanalysis: make failed prerequisites error detailed
Print actual error along with dep name.

Ref: #827
2020-03-15 13:47:35 +03:00
ferhat elmas
4d367808be Support disable rule when enable-all is true
Similar to the behavior of command line flags:
enable-all to enable existing linters then disable unwanted ones.
But for vet rules.
2020-03-11 17:20:26 +01:00
Trevor Pounds
c46c1b3224
Update to latest x/tools (#930)
* Update to latest x/tools (2020/01/19).

Fixes #893

* Initialize vet analyzers as unexportd global vars.

Fixes #915

* Support testing Go 1.14beta1.

* ci: reset go.mod and go.sum before generated diff check

* Update to latest x/tools (2020/02/04)

Co-authored-by: Aleksandr Razumov <ar@gortc.io>
2020-02-05 01:11:14 +03:00
Trevor Pounds
7a95e5ad30
Fix misspelled words. (#952) 2020-02-02 16:29:57 -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
Hiroki Suezawa
7368dd3604 Update gosec and add column
Signed-off-by: Hiroki Suezawa <suezawa@gmail.com>
2020-01-04 17:08:51 -05:00
Trevor Pounds
60c55133a6 Fix import order. 2019-12-30 09:05:39 -05:00
Chris Koch
7a58a86d38 unused: suggest deleting unused stuff
Signed-off-by: Chris Koch <chrisko@google.com>
2019-12-29 17:47:50 -05:00
Tommy Mühle
d9363991ed Update pkg/golinters/gomnd.go
Co-Authored-By: Simon Sawert <simon@sawert.se>
2019-12-05 07:55:04 -05:00
Tommy Mühle
704f9efede Update gomnd.go 2019-12-05 07:55:04 -05:00
sayboras
ca432c464a Addressed naming convention (#859) 2019-11-16 09:33:46 -05: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