22 Commits

Author SHA1 Message Date
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
Sean DuBois
f312a0fc4e fix #416: Add skip-dirs-use-default (#630) 2019-09-10 11:14:25 +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
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
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
d437ac8629 Implement auto-fixing for gofmt,goimports,misspell
Also, add more identifier marking patterns.
2019-02-17 20:31:31 +03:00
Aleksandr Razumov
a3a04552bb add support for exclude rules 2019-02-17 18:40:22 +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
7dfb9cff3d rework skip dir algorithm 2018-12-22 12:24:43 +03:00
Denis Isaev
84c9c65f39 fix #243: support Scopelint linter 2018-11-06 08:11:25 +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
8a478c47ac Prepare for #164: rename GAS to gosec
1. Rename in a backward compatible way
2. Remove gosec default exclude list because gosec is already disabled
by default.
3. Warn about unmatched linter names in //nolint directives
4. Process linter names in //nolint directives in upper case
5. Disable gosec for golangci-lint in .golangci.yml
2018-09-02 09:34:35 +03:00
Denis Isaev
e58c27e463 move source code lines extraction to processor and store source lines in output json 2018-08-18 17:27:45 +03:00
Denis Isaev
a6b91ccc77 Fix #124: support unparam linter
1. Support unparam linter and fix found issues
2. Replace forked mvdan.cc/lint and mvdan.cc/interfacer with the
upstream ones
3. Minimize forked megacheck: move the most of it's code to this repo
4. Use golang.org/x/tools/go/ssa import path instead of custom fork
paths
5. In golang.org/x/tools/go/{ssa,callgraph} use changed code from
honnef.co/go/tools
6. Add megacheck.check-unexported option: it found some issues in
the repo, fixed them all
2018-06-30 12:24:07 +03:00
Denis Isaev
1a9af12d6d Fix #96: support lll 2018-06-28 23:03:11 +03:00
Denis Isaev
7b2a63dfa6 Fix #100: misspell linter support 2018-06-28 21:52:30 +03:00
Denis Isaev
5514c4393e Fix #17, #87: govet becomes SLOW linter by default
1. Allow govet to work in 2 modes: fast and slow. Default is slow.
In fast mode golangci-lint runs `go install -i` and `go test -i`
for analyzed packages. But it's fast only when:
  - go >= 1.10
  - it's repeated run or $GOPATH/pkg or `go env GOCACHE` is cached
  between CI builds
In slow mode we load program from source code like for another linters
and do it only once for all linters.

3. Patch govet code to warn about any troubles with the type
information. Default behaviour of govet was to hide such warnings.
Fail analysis if there are any troubles with type loading: it will
prevent false-positives and false-negatives from govet.

4. Describe almost all options in .golangci.example.yml and
include it into README. Describe when to use slow or fast mode of govet.

5. Speed up govet: reuse AST parsing: it's already parsed once by
golangci-lint.
For "slow" runs (when we run at least one slow linter) speedup by
not loading type information second time.

6. Improve logging, debug logging

7. Fix crash in logging of AST cache warnings (#118)
2018-06-18 09:47:15 +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
61c0974323
improved warnings logging 2018-06-08 08:43:43 +03:00
golangci
034728ec94 generate parts of README automatically 2018-06-02 11:37:17 +03:00
golangci
0a111acaab refactor and don't print congrats if timeouted 2018-06-02 00:30:39 +03:00