45 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
a24cc87a06 refactor lintersdb: split it into abstractions 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
2db694a3ff exit with the code 5 if no go files to analyze 2018-08-17 21:20:54 +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
Romanos Skiadas
d3eb3ed74d point users to --new-from-rev=HEAD~ for CI setups in --help
Although the FAQ does eventually mention that
--new-from-rev=origin/master is the right way, --help does not and
using --new in CI is a terrible pitfall.

Make --help point users to -new-from-rev=HEAD~ for CI setups.

Also use HEAD~ instead of origin/master, since HEAD~ is more
universally applicable, e.g. if golangci-lint is ran against a release
branch.
2018-08-08 20:06:49 +03:00
Denis Isaev
069e66aa91 Closes #75: golangci-lint linters now prints current linters configuration 2018-07-29 20:28:27 +03:00
Fabrice Rabaute
e17b9543e7 Add tab-width option to lll linter 2018-07-25 23:13:14 +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
fb38e51c83 add all warnings and error to json if out-format=json 2018-06-24 11:29:41 +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
9fa9e2b3f8 Fix #106: fix transitive expanding of nolint: we could nolint more lines than needed 2018-06-16 10:56:58 +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
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
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
eee7e73dc1
#30: support --skip-files and --skip-dirs options: they skip files and dirs by regexps 2018-06-07 09:39:33 +03: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
f62d607410
#37: add tab output format: --out-format=tab 2018-06-02 21:01:09 +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
Denis Isaev
4fd5ebe7c7
#49: don't fill string slice 2 times because of double parsing of options 2018-06-02 17:50:38 +03:00
golangci
9133ef4271 generate command line options section of README 2018-06-02 16:01:20 +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
Will Dixon
d46a5896b7 Add Depguard to supported linters 2018-05-31 23:19:41 -04:00
golangci
ef81b998ed #45: fix no results for gocyclo 2018-05-30 20:01:44 +03:00
golangci
b28bf5fbee #41: exit with code 4 if timeouted 2018-05-30 09:45:08 +03:00
golangci
5646c61c73 #40: fix panic in fast mode 2018-05-30 09:18:13 +03:00
golangci
b12c5591cd #33: don't pass not compiling packages to linters accepting loader.Program 2018-05-29 18:41:04 +03:00
golangci
ae5152c024 fix GOROOT after cross-compilation 2018-05-29 14:15:09 +03:00
golangci
f6b51b933e use gocyclo with changes for upstreaming, also speedup it 10x when program is loaded 2018-05-28 17:36:16 +03:00
golangci
f96d8ba829 fix vendoring and log concurrency 2018-05-27 11:27:21 +03:00
golangci
cc53468e1e #13: fix --fast option: allow enable disabled by --fast linters 2018-05-26 21:07:38 +03:00
golangci
b361146df8 #12: add TypeCheck linter to report compilation errors 2018-05-26 20:02:26 +03:00
xuri
5b8ffcaf76
Fix typo. 2018-05-26 21:59:09 +08:00
golangci
17c05c062b add column of issue line; disable welcome message by default 2018-05-26 09:48:16 +03:00
golangci
ab0ce75c06 Fill README section about performance 2018-05-19 22:40:14 +03:00
golangci
cdc1251fc0 optimize linters scheduling: run slow linters first 2018-05-19 16:20:43 +03:00
golangci
328b32ac61 fix config validation 2018-05-19 13:07:55 +03:00
golangci
f6b2d368a0 started README 2018-05-15 09:07:27 +03:00
golangci
5c2e6e9f5a .travis.yml and don't use internal package 2018-05-13 19:20:42 +03:00