neomake icon indicating copy to clipboard operation
neomake copied to clipboard

add revive for go

Open delfick opened this issue 6 years ago • 9 comments

Hi,

Can we have an addition to the go linters for revive? https://github.com/mgechev/revive

I copied the golangci-lint definition and added this locally and it seems to work

function! neomake#makers#ft#go#revive() abort
    return {
        \ 'exe': 'revive',
        \ 'args': ['%t'],
        \ 'cwd': '%:h',
        \ 'errorformat':
            \ '%f:%l:%c: %m,' .
            \ '%f:%l: %m'
        \ }
endfunction

Thanks

delfick avatar Sep 26 '19 03:09 delfick

Sure, please create a PR. From the description it looks like it could be preferred automatically (based on executable('revive') then also over golint? https://github.com/neomake/neomake/blob/ba38b8786ce68c36fc3cd2139a7820b25bea378a/autoload/neomake/makers/ft/go.vim#L10

blueyed avatar Sep 26 '19 04:09 blueyed

Also example output, and a test would be nice to have then here or with the PR.

blueyed avatar Sep 26 '19 04:09 blueyed

ah yeah, I can have a look at doing that.

After some more consideration, how would I make it have a -config and -exclude options that you can set?

delfick avatar Sep 26 '19 06:09 delfick

how would I make it have a -config and -exclude options that you can set?

Does it support config files that it picks up automatically? That's usually the best.

blueyed avatar Sep 26 '19 07:09 blueyed

it would appear that revive only looks in your home directory for a config, so I could do something similar to what pylama does

let config_file = neomake#utils#FindGlobFile('revive.toml')

I'm not sure about exclude, but I did just realise it doesn't make sense to have it specified anyway because we're running revive against specific files.

delfick avatar Sep 26 '19 22:09 delfick

Hmm.. not sure what problem you are trying to solve.

See https://github.com/neomake/neomake/issues/1859 for appending args to existing makers. I think I should finish https://github.com/neomake/neomake/pull/2161.

blueyed avatar Sep 26 '19 23:09 blueyed

Does that allow for adding arguments before the last argument?

Because the -config argument has to come before the path you're linting.

delfick avatar Sep 26 '19 23:09 delfick

The path gets appended automatically in the end (via append_file=1 setting). Check also https://github.com/neomake/neomake/pull/2161.

blueyed avatar Sep 26 '19 23:09 blueyed

ah, awesome :)

delfick avatar Sep 26 '19 23:09 delfick