golangci / golangci-lint

Fast linters runner for Go
https://golangci-lint.run
GNU General Public License v3.0
15.53k stars 1.38k forks source link

Comparison of golangci-lint vs revive #162

Closed jsedgwick closed 6 years ago

jsedgwick commented 6 years ago

Can any maintainer give explicit insight here? We (org with 100s of KLOC) want to adapt one of the two, but would love to hear a sell from each. This project and revive are our two candidates. Can any maintainer tell us why we would choose this over revive? The biggest (so far) red flag is extensibility - adding a new linter is a PR here AFAICT. But we want to know more.

Thanks, and sorry for the vague question. You're doing great work here!

AlekSi commented 6 years ago

Cross-reference to https://github.com/mgechev/revive/issues/43.

jsedgwick commented 6 years ago

Thank you!

AlekSi commented 6 years ago

Still, golangci-lint maintainers may want to add their opinion.

jirfag commented 6 years ago

hi! @jsedgwick why do you choose between golangci-lint and revive? They are different tools. Golangci-lint aggregates dozens of tools with hundreds of checks. Revive is one of such tools (we didn't integrate it yet but we have golint).

It makes no sense to use only golint or revive for your project: these tools find only style issues (no comment, bad variable naming, etc) and count of rules is limited. Golangci-lint (and gometalinter) has a lot of tools for much more important issues searching (lock copy, forgotten context closing, unused variables, dead code, etc). If you look for only style issues we also have much more rules (linters) for them:

Linters presets:
bugs: govet, errcheck, staticcheck, gas, typecheck, megacheck
unused: unused, structcheck, varcheck, ineffassign, deadcode, megacheck, unparam
format: gofmt, goimports
style: golint, gosimple, interfacer, unconvert, dupl, goconst, megacheck, depguard, misspell, lll
complexity: gocyclo, nakedret
performance: maligned, prealloc

And how often do you need to manually extend linters? If you really need it you can use both revive and golangci-lint/gometalinter.

jsedgwick commented 6 years ago

Ok, think I get it now. Thanks.