354 Commits

Author SHA1 Message Date
Denis Isaev
952cc0b22e
fix hangup of golangci-lint on large projects with compilation errors 2018-11-10 14:32:26 +03:00
Denis Isaev
ac77eaac68 Fix #282, fix #209: revert goimports commit
ed64e33c8c8bc9a919e2b85a1a08225b5ae59d70. Also add tests
for local mode of goimports and do refactoring of tests.
2018-11-10 11:46:37 +03:00
Denis Isaev
7d51954355 fix #199: support gochecknoinits, gochecknoglobals
Add 2 new linters
2018-11-07 10:47:08 +03:00
Denis Isaev
a57bc83d70 On of cases for #260: fix crash in staticcheck
1. Fix crash if deps of analyzed packages weren't compiled.
2. Print deps typechecking errors
3. Fix all issues filtering because of empty go env GOCACHE for go < 1.10
2018-11-07 10:06:55 +03:00
Denis Isaev
0935ce1b8d fix #132: support go-critic linter 2018-11-07 09:11:08 +03:00
Denis Isaev
84c9c65f39 fix #243: support Scopelint linter 2018-11-06 08:11:25 +03:00
Denis Isaev
ccac35a87e Fix false positives with unused identifiers
Issue #265: don't report unused warning when an identifier is
used only in tests.
2018-11-05 14:11:14 +03:00
Denis Isaev
3345c7136f fix #264: fix Windows compatibility
Fix skip-dirs regexps and 'go env' on Windows.
2018-11-05 12:54:40 +03:00
Denis Isaev
a4d7d7a428
logging for corrupted SSA packages 2018-11-04 13:57:50 +03:00
Pavel Berezhnoy
f5f7701650 Fix #261: build-tags fix for package loader 2018-10-29 14:33:44 +03:00
Denis Isaev
87cb7bf1a6
Fix skip-dirs options after support of go/packages 2018-10-28 19:35:12 +03:00
Denis Isaev
8fceb7fc47
Fix #209: support goimports.local-prefix option for goimports 2018-10-28 18:47:56 +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
Peter Schuller
a84578d603 Tweak log entry for "not compiling" packages.
Motivation: Make it clear that the message is indicating packages
*which do not compile*, rather than packages which *won't be
compiled [for some unknown reason]*.
2018-10-28 16:54:37 +03:00
Diego Pontoriero
6ecea1cddc config: gas => gosec defaults.
Updates the strings to reflect the linter rename.
2018-10-20 11:17:41 +03:00
Cezar Sa Espinola
b307cc3765 Fix formatting with updated goimports version 2018-10-20 10:40:40 +03:00
Ariel Mashraki
3e87812087 address CR comments 2018-10-10 21:54:11 +03:00
Ariel Mashraki
b81346f9d3 linters/errcheck: add support for ignore/exclude flags
Add support for the exclude and ignore flags of errcheck.
Note that, this commit depends on golangci/errcheck#1. We need
to merge it first, update vendors and only then merge this one.
2018-10-10 21:54:11 +03:00
Denis Isaev
0c82b64123 return gosec default excludes: it's too annoying for users 2018-09-05 20:49:57 +03:00
Denis Isaev
0ef36f43d5 Prepare for #205: use forked repos without aliases 2018-09-02 14:46:54 +03:00
Denis Isaev
f93c2e0ab2 Fix #164: update GAS to the latest gosec 2018-09-02 09:34:35 +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
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
284447fc07 prettify issue texts 2018-08-18 23:04:27 +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
f81283f38d
get build package from packages.Package for golangci/golangci#12 2018-08-18 11:33:18 +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
a2b901227c Close #196: disable GAS (gosec) by default 2018-08-12 22:27:04 +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
9ec959f08e
Close #187: disable typecheck for golangci.com by default 2018-08-08 23:33:45 +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
Fabrice Rabaute
bc945a157b Improve lll parsing for very long lines
lll is using scanner.Scan() to read the file line by line.
scanner.Scan() might fail if the line is longer than bufio.MaxScanTokenSize
In the case where the specified maxLineLen is smaller than bufio.MaxScanTokenSize
we can return this line as a long line instead of returning an error.
The reason for this change is that this case might happen with autogenerated files
The go-bindata tool for instance might generate a file with a very long line.
In this case, as it's a auto generated file, the warning returned by lll will
be ignored.
But if we return a linter error here, and this error happens for an autogenerated
file the error will be discarded (fine), but all the subsequent errors for lll will
be discarded for other files and we'll miss legit error.
2018-08-02 21:35:02 +03:00
Denis Isaev
b1948fdbaa
remove GOLANGCI_COM_RUN: make runs in golangci.com and local runs identical 2018-07-29 23:52:10 +03:00
Denis Isaev
973c9fdfd8 Fix #126: fix working with symlinks 2018-07-29 22:45:35 +03:00
Denis Isaev
ca558ca571 Closes #154: set typecheker sizes as types.SizesFor(build.Default.Compiler, build.Default.GOARCH) 2018-07-29 22:30:55 +03:00
Denis Isaev
069e66aa91 Closes #75: golangci-lint linters now prints current linters configuration 2018-07-29 20:28:27 +03:00
Denis Isaev
d02ac2466e disable go1.11 in travis and make some small fixes for go1.11 2018-07-29 13:00:41 +03:00
Denis Isaev
c5721f50d0 update Gopkg.lock for a newer dep format and update x/tools package 2018-07-28 23:47:22 +03:00
Denis Isaev
5d04557a1f #156, #157: properly detect type errors in dependencies 2018-07-28 23:47:22 +03:00
Fabrice Rabaute
e17b9543e7 Add tab-width option to lll linter 2018-07-25 23:13:14 +03:00
Denis Isaev
1774bf22a2 Fix #148: fix false-positive from unused if cgo is used 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 2018-06-30 22:07:12 +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
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 2018-06-29 08:28:12 +03:00
Denis Isaev
1a9af12d6d Fix #96: support lll 2018-06-28 23:03:11 +03:00