24 Commits

Author SHA1 Message Date
Luke Shumaker
9ce337296b Makefile: Set GO111MODULE=on for consistency, adjust tests accordingly 2019-06-05 00:52:23 -04:00
Luke Shumaker
b51d53e11e make check_generated: Also check vendor/, not just README.md 2019-06-05 00:40:04 -04:00
Hui Zhu
8319caf63f Makefile: Add target build
kata-containers's ci will re-build and re-install golangci-lint every
time it did the staic check.
So run test of golangci-lint with build will make it slow.
Add target build to make golangci-lint just build but not test.

Fixes: #458

Signed-off-by: Hui Zhu <teawater@hyper.sh>
2019-03-31 19:37: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
87aae77943 Update gocritic
Fix #324, relates #314

1. Update gocritic to the latest version
2. Use proper gocritic checkers repo, old repo was archived
3. Get enabled by default gocritic checks in sync with go-critic: don't
enable performance, experimental and opinionated checks by default
4. Support of `enabled-tags` options for gocritic
5. Enable almost all gocritic checks for the project
6. Make rich debugging for gocritic
7. Meticulously validate gocritic checks config
2019-01-09 09:51:48 +03:00
Denis Isaev
4f0fddf4fe
add tests for abs path args 2018-12-22 14:16:31 +03:00
Denis Isaev
898ae4d364 fix #277, fix #260: fix crash
Fix crash because of parallel access to ssa.Program
2018-11-10 16:20:49 +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
6dd4f07c50
Fix file leak in lll 2018-06-29 08:28:12 +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
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
2a8eec1f70
dev: add release target to Makefile 2018-06-11 10:30:29 +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
golangci
9133ef4271 generate command line options section of README 2018-06-02 16:01:20 +03:00
golangci
d4d2697f8a add svg demo 2018-06-02 14:10:34 +03:00
golangci
0a111acaab refactor and don't print congrats if timeouted 2018-06-02 00:30:39 +03:00
golangci
5646c61c73 #40: fix panic in fast mode 2018-05-30 09:18:13 +03:00
golangci
5c2e6e9f5a .travis.yml and don't use internal package 2018-05-13 19:20:42 +03:00
golangci
85ee97f776 support config and fix issues in self project 2018-05-11 22:02:24 +03:00
golangci
d993d3a264 group of fixes after running on golang source code 2018-05-08 17:13:16 +03:00
golangci
6f384926cf fixes 2018-05-08 13:33:00 +03:00