15 Commits

Author SHA1 Message Date
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
47440bc2cc don't print config parsing info logs twice 2018-09-02 09:34:35 +03:00
Denis Isaev
b900926bfc Fix #121, fix #186: remove --silent,-s flag: be silent by default 2018-08-08 23:55:01 +03:00
Denis Isaev
3ce87e6245 Fix #139: don't fail govet on cgo 2018-06-30 09:23:31 +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
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
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
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
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
afc4b4344f
#66: properly merge (not overwrite) slice flags from config and command-line 2018-06-06 09:11:21 +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
Denis Isaev
b0826710b5
#52: #36: lint test files by default: set --tests=false to disable it 2018-06-02 18:24:00 +03:00
golangci
0a111acaab refactor and don't print congrats if timeouted 2018-06-02 00:30:39 +03:00