{"action":"created","issue":{"url":"https://api.github.com/repos/alecthomas/gometalinter/issues/380","repository_url":"https://api.github.com/repos/alecthomas/gometalinter","labels_url":"https://api.github.com/repos/alecthomas/gometalinter/issues/380/labels{/name}","comments_url":"https://api.github.com/repos/alecthomas/gometalinter/issues/380/comments","events_url":"https://api.github.com/repos/alecthomas/gometalinter/issues/380/events","html_url":"https://github.com/alecthomas/gometalinter/issues/380","id":270553718,"number":380,"title":"API based integration with linters","user":{"login":"vektah","id":2247982,"avatar_url":"https://avatars0.githubusercontent.com/u/2247982?v=4","gravatar_id":"","url":"https://api.github.com/users/vektah","html_url":"https://github.com/vektah","followers_url":"https://api.github.com/users/vektah/followers","following_url":"https://api.github.com/users/vektah/following{/other_user}","gists_url":"https://api.github.com/users/vektah/gists{/gist_id}","starred_url":"https://api.github.com/users/vektah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vektah/subscriptions","organizations_url":"https://api.github.com/users/vektah/orgs","repos_url":"https://api.github.com/users/vektah/repos","events_url":"https://api.github.com/users/vektah/events{/privacy}","received_events_url":"https://api.github.com/users/vektah/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":23,"created_at":"2017-11-02T07:07:25Z","updated_at":"2018-05-26T10:54:37Z","closed_at":null,"author_association":"NONE","body":"Most of the time spent running gometalinter is due to each linter parsing the project individually. \r\n\r\nThis leads to a lots of wasted effort and cycles:\r\n - linter aggregators pop up eg [megacheck](https://github.com/dominikh/go-tools/tree/master/cmd/megacheck)\r\n - lots of duplicated parsing code\r\n - subtle differences in the way paths are read\r\n - installing metalinter requires installing all the sublinters. versioning is awkward.\r\n\r\npath bugs are probably the worst, as they often lead to silent failures where the linter being called does nothing but does not fail.\r\n\r\nWhat I propose instead is two interfaces that external linters can satisfy.\r\n\r\nOne for linters that work on the raw file, without the ast:\r\n```go\r\ntype FileLinter func(filename string) []Error\r\n```\r\n\r\nand one for the heavier linters that use the AST\r\n```go\r\ntype ASTLinter func(file *ast.File, scope *types.Scope) []Error\r\n```\r\n\r\nThis has a bunch of benefits:\r\n - gometalinter can vendor in the linters making it easy to `go get`\r\n - gometalinter could ship a single precompiled binary release without the need for --install\r\n - gometalinter can do one parse of the source\r\n - writing a new linter is easier if you dont need to write a cli interface, gometalinter (or another separate package) could even provide a stand alone linter cli interface so the go linter ecosystem can start to stabilize their cli interfaces.\r\n - standardizing on a linting error type means richer context than can be returned by parsing cli output\r\n - panics from a linter much easier to deal with"},"comment":{"url":"https://api.github.com/repos/alecthomas/gometalinter/issues/comments/392253550","html_url":"https://github.com/alecthomas/gometalinter/issues/380#issuecomment-392253550","issue_url":"https://api.github.com/repos/alecthomas/gometalinter/issues/380","id":392253550,"user":{"login":"golangci","id":35628013,"avatar_url":"https://avatars3.githubusercontent.com/u/35628013?v=4","gravatar_id":"","url":"https://api.github.com/users/golangci","html_url":"https://github.com/golangci","followers_url":"https://api.github.com/users/golangci/followers","following_url":"https://api.github.com/users/golangci/following{/other_user}","gists_url":"https://api.github.com/users/golangci/gists{/gist_id}","starred_url":"https://api.github.com/users/golangci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/golangci/subscriptions","organizations_url":"https://api.github.com/users/golangci/orgs","repos_url":"https://api.github.com/users/golangci/repos","events_url":"https://api.github.com/users/golangci/events{/privacy}","received_events_url":"https://api.github.com/users/golangci/received_events","type":"User","site_admin":false},"created_at":"2018-05-26T10:54:36Z","updated_at":"2018-05-26T10:54:36Z","author_association":"NONE","body":"take a look at https://github.com/golangci/golangci-lint: it does API based integration with dozens of linters.\r\n\r\n@liut0 cool project, we've done similar tool; maybe we didn't build it if we'd found gomultilinter before."}}
{"actor":{"display_login":"golangci"}}