98 Commits

Author SHA1 Message Date
Oleg Butuzov
6e7c317610
Sorting result.Issues implementation (golangci/golangci-lint#1217) (#1218) 2020-07-12 16:35:08 -05:00
Joe Wilner
6550984878
Configure path prefix via processor abstraction (#1226) 2020-07-11 09:14:52 +10:00
Duco van Amstel
5f0de2982b
Protect NewFilenameUnadjuster from concurrent map writes (#1192) 2020-06-25 14:57:49 +02:00
Soichiro Kashima
71b2f04e88
handle some block comment to detect generated files (#1161) 2020-05-25 19:36:46 +03:00
Ryan Currah
fa7adcbda9
add ability to set issue severity (#1155)
* add ability to set issue severity for out formats that support it based on severity rules

* fix lint issues

* change log child name

* code climate omit severity if empty

* add tests for severity rules, add support for case sensitive rules, fix lint issues, better doc comments, share processor test

* deduplicated rule logic into a base rule that can be used by multiple rule types, moved severity config to it's own parent key named severity, reduced size of NewRunner function to make it easier to read

* put validate function under base rule struct

* better validation error wording

* add Fingerprint and Description methods to Issue struct, made codeclimate reporter easier to read, checkstyle output is now pretty printed
2020-05-25 08:21:42 -04:00
Andrew Shannon Brown
90a8cd41bd
Fix up nolintlint comments and urls (#1164) 2020-05-24 10:08:14 +03:00
Isaev Denis
279b6d62d3
speed up a bit (#1064)
Ensure that `unused` is always the last
in execution order. It can speed up packages loading
a bit.

Refactor enabled linters set to remove extra logging.

Relates: #944
2020-05-05 18:45:19 +03:00
Isaev Denis
38782dd097
dev: use golangci-lint action (#1066) 2020-05-05 17:51:55 +03:00
Andrew Shannon Brown
ef44e11e17
Merge branch 'master' into asb/nolintlint-internal 2020-04-29 15:27:35 -07:00
Aleksandr Razumov
56f2b7d59d
fixer: add warning about possible line range issue 2020-04-27 20:11:42 +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
Maciej "Iwan" Iwanowski
078f44f8aa Getting rid of code duplication
Signed-off-by: Maciej "Iwan" Iwanowski <maciej.iwanowski@critical.today>
2020-04-23 18:37:40 +02:00
Maciej "Iwan" Iwanowski
94f8d6aacb
Ensuring interface implementation
Signed-off-by: Maciej "Iwan" Iwanowski <maciej.iwanowski@critical.today>
2020-04-23 09:32:55 +02:00
Maciej "Iwan" Iwanowski
05138497f2
Adding case sensitive exclude rules support
Signed-off-by: Maciej "Iwan" Iwanowski <maciej.iwanowski@critical.today>
2020-04-23 09:23:37 +02:00
Maciej "Iwan" Iwanowski
a68b411e4a
Adding case-sensitive exclude processor
Signed-off-by: Maciej "Iwan" Iwanowski <maciej.iwanowski@critical.today>
2020-04-22 18:40:10 +02:00
Aleksandr Razumov
a2bc9b7a99
Merge pull request #937 from Khan/fix-range-start
Change writeFixedFile to replace the right line-range.
2020-03-12 20:29:04 +03:00
Aleksandr Razumov
8100507682 autogenerated_exclude: increase scanner max buffer size
Ref: #954
2020-02-28 14:09:52 +03:00
Aleksandr Razumov
18ab7a0005
autogenerated_exclude: increase scanner buffer (#955)
* autogenerated_exclude: increase scanner buffer

Some lines can be very long, so increase scanner
buffer to mitigate this.

Fix #954
2020-02-03 20:42:30 +03:00
Craig Silverstein
06d26d5c12 Change writeFixedFile to replace the right line-range.
The function assumed, previously, that issue.Line always equals
issue.LineRange.From.  But this needn't be true, and the code needn't
assume it.  Now we actually replace the specified line-range.
2020-01-22 09:14:40 -08:00
to6ka
d137c2e18c make uniq by line configurable (#920) 2020-01-19 16:49:46 +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
Igor Zibarev
ecccb24cb7 Fix autogen exclude for comments under package (#831) 2019-10-22 09:49:47 +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
Trevor Pounds
fd997edeeb Cleanup nolint directives. (#779) 2019-10-03 19:34:19 +03:00
Trevor Pounds
6d786b50ae Group imports by package. 2019-10-01 18:09:47 -04:00
Isaev Denis
df4f6766ba
reduce 1.5x memory usage on large repos on repeated runs (#764)
Get rid of AST cache: load AST when needed. Optimize memory allocations
for go/analysis actions.

Relates: #337
2019-10-01 14:52:00 +03: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
Trevor Pounds
a16b4d872b Use stretchr/testify to mock log.
Simplifies test log usage and removes additional
targets and dependencies to go:generate mocks.
2019-09-24 11:58:40 -04:00
Denis Isaev
fc8d614b2b
speedup skip-dirs processing by caching 2019-09-14 20:15:11 +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
Trevor Pounds
2e8d83266f Update dependencies. (#684)
* Update deps.

* Update to Node.js v10.16.3 LTS.

* Fix mock logutils generation.
2019-09-12 16:02:43 +03:00
Isaev Denis
f1c1dbfab4
Feature/enable autofix on whitespace (#674)
The whitespace linter was added in #673. Enable it and fix found issues.
Add auto-fixing to the whitespace linter.
2019-09-10 16:56:44 +03:00
Isaev Denis
6864b2f764
dev: enable funlen on repo (#668) 2019-09-09 18:07:09 +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
7db400b2d2 fix #521: explain //nolint usage in README
Also, add more tests for block-wise
usage of //nolint.
2019-06-09 17:27:42 +03:00
Denis Isaev
ec5bf9b67b Fix linting of goyacc files
Skip yacctab, yaccpar and NONE files.

Relates: #467, #468
2019-04-20 22:30:48 +03:00
Denis Isaev
ed0b551070 Fix linting of preprocessed files
Preprocessed files like .qtpl.go quicktemplate Go files can have
//line directives. They map to a source .qtpl file.
This commit fixes linting of such files:
1. don't fail on AST cache loading
2. output Go filename not .qtpl or similar

Also, here we update golint to the upstream version.

Relates: #316, #466, #467, #468
2019-04-20 21:50:26 +03:00
Denis Isaev
396a04630d dev: improve memory tracking 2019-03-31 22:33:18 +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
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
Denis Isaev
307c287356 Fix #388: include staticcheck check name into a message 2019-02-17 23:50:11 +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
Aleksandr Razumov
e672537942 remove obvious TODO about concurrent exclude rule processing 2019-02-17 18:40:22 +03:00
Aleksandr Razumov
30bfd60b2b improve tests for exclude rules 2019-02-17 18:40:22 +03:00
Aleksandr Razumov
edd055f862 config: add validation for exclude rules 2019-02-17 18:40:22 +03:00
Aleksandr Razumov
a3a04552bb add support for exclude rules 2019-02-17 18:40:22 +03:00
Denis Isaev
7705f82591 Update megacheck to the latest version
Also do following improvements:
  - show proper sublinter name for megacheck sublinters
  - refactor and make more simple and robust megacheck
  merging/optimizing
  - improve handling of unknown linter names in //nolint directives
  - minimize diff of our megacheck version from the upstream,
  https://github.com/golang/go/issues/29612 blocks usage of the upstream
  version
  - support the new `stylecheck` linter
  - improve tests coverage for megacheck and nolint related cases
  - update and use upstream versions of unparam and interfacer instead of forked
  ones
  - don't use golangci/tools repo anymore
  - fix newly found issues after updating linters

Also should be noted that megacheck works much faster and consumes less
memory in the newest release, therefore golangci-lint works noticeably
faster and consumes less memory for large repos.

Relates: #314
2019-01-08 21:16:15 +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
99329fb637
dev: remove extra logging in skip dirs processor 2018-12-22 13:44:16 +03:00
Denis Isaev
7dfb9cff3d rework skip dir algorithm 2018-12-22 12:24:43 +03:00