359 Commits

Author SHA1 Message Date
Denis Isaev
79776b41f9 Fix #150: don't recommend vendoring of golangci-lint in README 2018-07-03 09:52:13 +03:00
Denis Isaev
1774bf22a2 Fix #148: fix false-positive from unused if cgo is used v1.9.1 2018-07-01 21:52:21 +03:00
Denis Isaev
95b0757a3f Fix marking file with cgo as autogenerated 2018-07-01 21:52:21 +03:00
Denis Isaev
894ba0df9f Resolve #146: prealloc linter support v1.9 2018-06-30 22:07:12 +03:00
Denis Isaev
815d13148f docs: add changelog, rewrite internal section, add trusted by section 2018-06-30 21:00:47 +03:00
Denis Isaev
35f9d8e5b9 Fix unparam crash on nil constant 2018-06-30 20:08:05 +03:00
Denis Isaev
facc3a096a Fix #98: nakedret linter support 2018-06-30 15:41:47 +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
70193b9b4d
docs: improve shell installation info 2018-06-30 09:24:50 +03:00
Denis Isaev
3ce87e6245 Fix #139: don't fail govet on cgo 2018-06-30 09:23:31 +03:00
Denis Isaev
6dd4f07c50
Fix file leak in lll v1.8.1 2018-06-29 08:28:12 +03:00
Denis Isaev
1a9af12d6d Fix #96: support lll v1.8 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
88ebabc4bc Fix #109, #116, #131: don't report in deadcode about unused test functions in main package v1.7.3 2018-06-28 10:17:16 +03:00
Denis Isaev
5ef542facd Print first compilation error in warning about inability to run megacheck because of compilation errors 2018-06-28 09:18:41 +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
93311aee9b Fix #122: don't crash govet on tests-only packages v1.7.2 2018-06-19 16:32:36 +03:00
Denis Isaev
ebbfc26e88 Fix #94: load object files for govet for old go
Do it in compatible with old go versions object files way:
use golang.org/x/tools/go/gcexportdata instead of importer.Default
v1.7.1
2018-06-19 09:59:13 +03:00
Denis Isaev
78d39711f0
docs: s/.golangci.yml/.golangci.example.yml 2018-06-19 09:30:55 +03:00
Denis Isaev
020c948089 Analyze project even if fatal import dir error
Before that fix golangci-lint couldn't run analysis
if in any dir there was go file with corrupted `package` or `import`
statement.
After that fix it will only warn about such files and continue analysis.
But it will fail analysis after finding 10 packages with such errors
to not being too noisy in case of internal error.
2018-06-18 23:50:47 +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)
v1.7
2018-06-18 09:47:15 +03:00
Henrik Johansson
f239b80ce1 disable the congrats message
There is now an extra switch '-s' to disable the congrats message when
there are no issues detected

Fixes: #110
2018-06-17 00:17:48 +03:00
Denis Isaev
2de1f87c10 Fix #102: fix file descriptors leak inside errcheck 2018-06-16 12:57:10 +03:00
Denis Isaev
9fa9e2b3f8 Fix #106: fix transitive expanding of nolint: we could nolint more lines than needed 2018-06-16 10:56:58 +03:00
Iskander Sharipov
7495c4d13a readme: fix invalid link to issues-options
issues-options heading does not exist anymore.
Closes thing is command-line-options.
2018-06-15 22:41:20 +03:00
Denis Isaev
7f1779d706
docs: remove extra backtick from README.md.tmpl
Fix stale template after #103
2018-06-15 00:06:30 +03:00
Sriram Venkatesh
7f17cf01e5 Remove extra backtick in install step
This just removes the extra back in the `go install` step. Helps people (like me) that just copy paste blindly into a Makefile or into the cmdline!
2018-06-15 00:04:42 +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
Maksym
219a5479c8 Checkstyle support (#95)
Implement checkstyle printer
2018-06-13 20:54:13 +03:00
Denis Isaev
a1a9215fcc Speedup program loading on 20%.
Don't typecheck func bodies for non-local packages.
Works only if megacheck and interfacer are disabled: they require all
func bodies to build SSA repr.
Export GL_DEBUG=load to get logs for this feature.
2018-06-13 20:45:46 +03:00
Isaev Denis
6480aa8b19
Merge pull request #89 from golangci/support/fix-mockgen-detecting
Write debug logs for autogen excluding for #86
2018-06-12 15:44:23 +03:00
Denis Isaev
f9027f7dbe
Write debug logs for autogen excluding for #86 2018-06-12 15:32:34 +03:00
Denis Isaev
b4bf038095
docs: improve FAQ and remove -i from go install command 2018-06-12 14:20:36 +03:00
Denis Isaev
6e12ea5734
docs: add FAQ entry about go install 2018-06-12 10:07:10 +03:00
Denis Isaev
1ff1d6733f
ignore 'comment on exported type ... should be of the form' by default 2018-06-11 18:57:33 +03:00
Denis Isaev
84520c527e
dev: add forgotten file test/testdata/autogenerated/mockgen.go 2018-06-11 12:51:06 +03:00
Isaev Denis
7c70250d8c
Merge pull request #84 from golangci/support/detect-mockgen-properly
Properly detect generated files: fix detection when
v1.6.1
2018-06-11 12:47:17 +03:00
Denis Isaev
7f833070b1
Properly detect generated files: fix detection when
there is extra line between comment about generated file and package
name
2018-06-11 12:38:52 +03:00
Isaev Denis
89921943e1
Merge pull request #83 from golangci/feature/improve-json-output
Write JSON output more compactly and output object, not array
2018-06-11 11:46:43 +03:00
Denis Isaev
541656cc20
Write JSON output more compactly and output object, not array 2018-06-11 11:19:40 +03:00
Denis Isaev
2a8eec1f70
dev: add release target to Makefile 2018-06-11 10:30:29 +03:00
Isaev Denis
34fa0b0715
Merge pull request #82 from golangci/feature/match-more-autogenerated-files
Fix #72: match more autogenerated files patterns.
v1.6
2018-06-11 09:46:34 +03:00
Denis Isaev
adb6be78bb
Fix #72: match more autogenerated files patterns.
We skip all issues from autogenerated files.
Also reuse AST parsing for nolint and autogenerated exclude processors:
decrease processing time on golang source code from 3s to 800ms.
2018-06-11 00:51:23 +03:00
Isaev Denis
46088deacf
Merge pull request #81 from golangci/feature/fix-common-failures
Feature/fix common failures
2018-06-10 23:53:30 +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
f5a9bbb140
don't run megacheck if there are not compiling packages and warn about it 2018-06-10 09:22:21 +03:00
Isaev Denis
616bc37d6a
Merge pull request #79 from alecthomas/master
Allow --enable, --enable-all and --fast to coexist.
2018-06-09 17:29:33 +03:00
Alec Thomas
581a3564ff Allow --enable, --enable-all and --fast to coexist.
This is useful to first enable all linters (including fast ones), then
only enable fast linters, then add extra linters. eg.

```
golangci-lint run --no-config --enable-all --fast --print-issued-lines=false \
    --exclude-use-default=false --tests --enable typecheck .
```
2018-06-09 19:49:24 +10:00
Denis Isaev
9ed7dad894
#77: move changes from README.md to README.md.tmpl 2018-06-09 00:01:54 +03:00
Isaev Denis
94ba831a89
Merge pull request #77 from charl/master
Language changes and fixed some typos.
2018-06-08 23:23:54 +03:00