49 Commits

Author SHA1 Message Date
Yusuke Kadowaki
8674597b84
add linter zerologlint (#3726)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2023-04-16 18:17:49 +02:00
Nahshon Unna Tsameret
26dde52d69
Add the ginkgolinter linter (#3369) 2022-12-26 22:03:07 +01:00
Timon Wong
3a2ad9083a
feat: rename logrlint to loggercheck (#3144) 2022-09-06 23:23:32 +02:00
Ludovic Fernandez
19a338706a
dev: reference all the debug keys and env vars (#3196) 2022-09-06 11:48:25 +00:00
Ludovic Fernandez
bddc63a234
dev: fix CI workflow for Windows (#3134) 2022-08-24 22:10:51 +02:00
Ludovic Fernandez
77962e9283
dev: fix linter tests (#3128) 2022-08-23 10:33:57 +02:00
Timon Wong
f48530e25e
feat: add logrlint (#3093)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2022-08-22 22:49:39 +02:00
Ludovic Fernandez
e1afce4433
dev: improve runner to run dir with go.mod (#3124) 2022-08-21 16:51:36 +02:00
Ludovic Fernandez
2b4c9ab4fc
dev: follow standards by using 'want' instead of 'ERROR' for tests (#3104) 2022-08-20 18:53:45 +02:00
Ludovic Fernandez
5e140494b6
dev: rewrite the tests framework (#3100) 2022-08-15 21:56:32 +02:00
Ludovic Fernandez
f7fba37cc9
dev: replace golangcitest:config by golangcitest:config_path (#3099) 2022-08-15 18:23:07 +02:00
Ludovic Fernandez
1557692e59
feat: go1.19 support (#3037) 2022-08-03 20:53:06 +02:00
Ludovic Fernandez
27f921fa14
dev: use directives instead of comments for tests (#2978) 2022-07-15 15:32:10 +02:00
Loong Dai
2f41c1f06b
gci: fix issues and re-enable autofix (#2892)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2022-05-30 19:51:38 +02:00
Ludovic Fernandez
13c4726760
dev: support build tags about go version in linter tests (#2744) 2022-04-06 10:44:20 +02:00
Ludovic Fernandez
7bbbe77e5e
feat: automatic Go version detection (#2669)
Some checks failed
Release a tag / release (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
* feat: disable unsupported go1.18 govet analyzers
* fix: inactivate interfacer with go1.18
2022-03-23 16:54:11 +01:00
ngehrsitz
f7d2406dc6
bump github.com/daixiang0/gci from 0.2.9 to 0.3.0 (#2532)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2022-02-14 09:51:24 +01:00
Lauris BH
d209389625
Add support for multiple outputs (#2386) 2022-01-04 21:36:27 +01:00
Sebastien Rosset
2c01ea7ff2
gocritic: add support for variable substitution in ruleguard path settings (#2308)
* Add  variable for ruleguard config directory

* Add  variable for ruleguard config directory

* Add  variable for ruleguard config directory

* Add  variable for ruleguard config directory

* Add unit tests

* Add unit tests for ruleguard

* Add unit tests for ruleguard

* Add unit tests for ruleguard

* Add unit tests for ruleguard, fix package name
2021-11-02 11:34:19 -07:00
Benjamin
e5cd59a607
dev: replace ioutil with io and os (#2318) 2021-11-01 20:21:26 +01:00
Ludovic Fernandez
fcef82475c
docs: improve linters page (#1995)
* TOC level 3
* drop `.golangci.yaml` from the Configuration page
* generate a dedicated configuration section for each linters.
* fix changelog heading
2021-05-17 23:56:46 +02:00
Ludovic Fernandez
9838a57941
dev: remove old TODO and remove assert import alias on require. (#1838) 2021-03-13 04:45:32 +01:00
Andrew Shannon Brown
ec46f42e01
Verify linter name in integration tests (#1595) 2021-01-15 21:37:56 +01:00
Ludovic Fernandez
e5a395b2c8
Update mvdan.cc/gofumpt to v0.1.0 (#1637) 2021-01-08 16:48:56 +01: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
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
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
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
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
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
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
Trevor Pounds
6d786b50ae Group imports by package. 2019-10-01 18:09:47 -04:00
Denis Isaev
a5c44d2076 go1.11 compatibility fixed 2019-03-05 21:44:52 +03:00
Denis Isaev
466006b463 go1.12: migrate from perl GOROOT/test/errcheck 2019-03-05 21:20:43 +03:00
Denis Isaev
d437ac8629 Implement auto-fixing for gofmt,goimports,misspell
Also, add more identifier marking patterns.
2019-02-17 20:31:31 +03:00
Denis Isaev
609de3254c Fix #331: fix errcheck "ignore" config directive.
Make tests for "ignore" and "exclude" directives.
Mark all hidden command-line options as deprecated.
2018-12-23 12:33:41 +03:00
Denis Isaev
a4a7100011 Fix #263: update goimports
The new version of goimports works 100x faster
with go modules. Also it has some new features:

$ git cherry -v 6c7e314b6563 92cdcd90bf52 | fgrep imports
+ 5bbcdc15656ef390fab5dd6e8daf95354f7171e3 imports: redesign fixImports
+ ee45598d2ff288037f53f9e13ae0b1a6e2165ad5 imports: create named imports for name/path mismatches (again)
+ 4c53570e0460bc32468f75bf9dd71c018d03bfa9 imports: ignore globals in different packages
+ 1d424dbce8dd500e9e449fd3ff9d0668c09e2ae1 imports: clean up customization seam
+ 6a3e9aa2ab7749d72d1006ee484271b4a11f96c2 imports: fix renamed sibling imports
+ 5f4a60f04f23ac48e0665f257413ae3eacf339be imports: fix renamed sibling imports more
+ bbccd8cae4a9a47e0f978e03ff4b5df88a9fde1e imports: use go/packages, support modules
+ d4971274fe382404aee0e8c163af974f2bf738e6 imports: don't remove imports that conflict with globals
2018-12-22 15:50:16 +03:00
Denis Isaev
c9c0646265 dev: fix go.sum and don't skip test TestGoimportsLocal 2018-12-22 15:34:16 +03:00
Denis Isaev
ac77eaac68 Fix #282, fix #209: revert goimports commit
ed64e33c8c8bc9a919e2b85a1a08225b5ae59d70. Also add tests
for local mode of goimports and do refactoring of tests.
2018-11-10 11:46:37 +03:00
Denis Isaev
c02a6daa5c Fix #263: fix goimports performance with modules
Apply https://go-review.googlesource.com/c/tools/+/132598/ as a
temporary fix before a proper fix is in golang.org/x/tools
2018-11-05 12:37:54 +03:00
Denis Isaev
8fceb7fc47
Fix #209: support goimports.local-prefix option for goimports 2018-10-28 18:47:56 +03:00
Denis Isaev
0421bac259 Fix #237, fix #178: use go/packages
Use go/packages instead of x/tools/loader: it allows to work
with go modules and speedups loading of packages with the help
of build cache.

A lot of linters became "fast": they are enabled by --fast now and
work in 1-2 seconds. Only unparam, interfacer and megacheck
are "slow" linters now.

Average project is analyzed 20-40% faster than before if all linters are
enabled! If we enable all linters except unparam, interfacer and
megacheck analysis is 10-20x faster!
2018-10-28 17:55:15 +03:00
Denis Isaev
7b2a63dfa6 Fix #100: misspell linter support 2018-06-28 21:52:30 +03:00
Denis Isaev
9181ca7175 Fix #78: log all warnings
1. Log all warnings, don't hide none of them
2. Write fatal messages (stop analysis) with error log level
3. Remove ugly timestamp counter from logrus output
4. Print nested module prefix in log
5. Make logger abstraction: no global logging anymore
6. Refactor config reading to config.FileReader struct to avoid passing
logger into every function
7. Replace exit codes hardcoding with constants in exitcodes package
8. Fail test if any warning was logged
9. Fix calculation of relative path if we analyze parent dir ../
10. Move Runner initialization from Executor to NewRunner func
11. Log every AST parsing error
12. Properly print used config file path in verbose mode
13. Print package files if only 1 package is analyzedin verbose mode,
  print not compiling packages in verbose mode
14. Forbid usage of github.com/sirupsen/logrus by DepGuard linter
15. Add default ignore pattern to folint: "comment on exported const"
2018-06-14 23:09:04 +03:00
Denis Isaev
2b587b63d6
Load AST for fast linters in different way.
Use build.Import instead of manual parser.ParseFile and paths traversal. It allows:
1. support build tags for all linters.
2. analyze files only for current GOOS/GOARCH: less false-positives.
3. analyze xtest packages (*_test) by golint: upstream golint and
gometalinter can't do it! And don't break analysis on the first xtest
package like it was before.
4. proper handling of xtest packages for linters like goconst where
package boundary is important: less false-positives is expected.

Also:
1. reuse AST parsing for golint and goconst: minor speedup.
2. allow to specify path (not only name) regexp for --skip-files and
--skip-dirs
3. add more default exclude filters for golint about commits:
`(comment on exported (method|function)|should have( a package)?
    comment|comment should be of the form)`
4. print skipped dir in verbose (-v) mode
5. refactor per-linter tests: declare arguments in comments, run only
one linter and in combination with slow linter
2018-06-10 23:46:24 +03:00
Denis Isaev
0f6213dbc2
#60: search config file in directories from file path up to root 2018-06-02 20:28:53 +03:00
golangci
0a111acaab refactor and don't print congrats if timeouted 2018-06-02 00:30:39 +03:00