46 Commits

Author SHA1 Message Date
Ludovic Fernandez
e5b30649e6
dev: add Go version to version information (#3625) 2023-03-02 00:34:22 +01:00
Oleksandr Redko
f4fec8c6d0
dev: bytes.NewBuffer/bytes.NewBufferString to shorten initialization (#3632) 2023-02-24 16:40:18 +01:00
Oleksandr Redko
b673c5c1af
dev: replace pkg/errors with native error wrapping (#3604)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2023-02-22 01:35:43 +01:00
Ludovic Fernandez
19a338706a
dev: reference all the debug keys and env vars (#3196) 2022-09-06 11:48:25 +00:00
dependabot[bot]
9da04f5070
build(deps): bump github.com/go-critic/go-critic from 0.6.3 to 0.6.4 (#3089)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2022-08-14 18:21:32 +02:00
Ludovic Fernandez
8bdc4d3f80
fix: help command (#2681)
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
2022-03-24 12:49:36 +01: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
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
Sebastien Rosset
bdc2f96de9
Add code comments to document source code (#2306) 2021-10-25 00:06:58 +02:00
Tam Mach
a6fcf6f001
cleanup: Remove completion subcommand (#2107) 2021-07-07 13:07:49 +02:00
Ludovic Fernandez
cf8fd685d0
revive: fix add-constant rule support. (#2003) 2021-05-19 17:39:10 +02:00
Sergey Vilgelm
b77118fdac
Use errcheck from main repo instead of golangci-lint fork (#1319)
Co-authored-by: Roman Leventov <leventov@ya.ru>
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2021-02-25 13:16:48 +01:00
Romanos
1a2a672644
Allow for serializing multiple golangci-lint invocations (#1302)
By default, golangci-lint fails after five seconds if another instance
is running. It is possible to disable that, but the discussion around
whether the cache is safe to use concurrently is not exactly full of
confidence. Add a flag that allows golangci-lint to wait forever
instead of failing.

see #1301
2020-08-28 14:06:28 +08: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
Carlton Henderson
bec09851bf
fix #869 by removing lock file after unlocking (#947) 2020-02-04 23:47:39 +03: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
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
Trevor Pounds
60c55133a6 Fix import order. 2019-12-30 09:05:39 -05:00
Isaev Denis
fa69ddfc14
fix not cross-os file lock (#818) 2019-10-14 19:46:59 +03:00
Isaev Denis
64b62667c0
Lock by flock to prevent parallel runs (#812) 2019-10-13 18:10:22 +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
M. Ángel
5e54b3334e Add version command to print golangci-lint version
Fixes #675
2019-10-01 18:13:24 -04:00
Trevor Pounds
6d786b50ae Group imports by package. 2019-10-01 18:09:47 -04: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
Christoph Blecker
91e90eba6b Add support for bash completions (#640) 2019-09-10 11:30:02 +03:00
Denis Isaev
3d78f64b60 fix #522: run misspell in text mode
Treat Go source files as plain text files by misspell: it allows detecting
issues in strings, variable names, etc. Also, it's the default mode of
a standalone misspell tool.

Also, implement richer and more stable auto-fix of misspell issues:
now it can fix multiple issues in one line.
2019-06-09 20:14:19 +03:00
Denis Isaev
8c1237b667 Use the newest go vet
The newest go vet based on go/analysis
2019-03-17 23:12:44 +03:00
Ben Paxton
f13d8387d3 fix help generation; update README 2019-03-17 15:27:45 +03:00
Ben Paxton
c41b1e2034 Add --color flag to force colored output on/off 2019-03-17 15:27:45 +03:00
Denis Isaev
3d2dfac47e Support excluding issues by source line regexp
See issues.exclude-rules[i].source.
Also introduced file data and file lines cache.
2019-03-17 15:17:29 +03:00
David López
d9a1bdb831 gocritic: fix code to pass newly added gocritic checks
Fix code to pass newly added gocritic checks, mainly pointer receivers and import shadows
2019-01-08 09:59:24 +03:00
Denis Isaev
27752e81a7 add command 'golangci-lint config path' 2018-11-18 11:28:59 +03:00
Denis Isaev
0935ce1b8d fix #132: support go-critic linter 2018-11-07 09:11:08 +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
47440bc2cc don't print config parsing info logs twice 2018-09-02 09:34:35 +03:00
Denis Isaev
a24cc87a06 refactor lintersdb: split it into abstractions 2018-09-02 09:34:35 +03:00
Denis Isaev
069e66aa91 Closes #75: golangci-lint linters now prints current linters configuration 2018-07-29 20:28:27 +03:00
Denis Isaev
1a9af12d6d Fix #96: support lll 2018-06-28 23:03:11 +03:00
Denis Isaev
fb38e51c83 add all warnings and error to json if out-format=json 2018-06-24 11:29:41 +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
ad3bf1eb58
fix --version option and improve installation section of docs 2018-06-03 09:25:53 +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
0e4282179f make releases 2018-05-29 11:18:47 +03:00
golangci
5c2e6e9f5a .travis.yml and don't use internal package 2018-05-13 19:20:42 +03:00