neomake
neomake copied to clipboard
Adding arguments to existing maker
I have a question, what is the preferred way to modify the args existing makers.
I need to add --extension-pkg-whitelist=numpy to the args of pylint (see Pylint and Numpy produce E1101 messages to suppress the annoying wrong [no-member] messages.
I didn't find what is the preferred way in the docs. Do I overwrite the function
function! neomake#makers#ft#python#pylint() abort
let maker = {
\ 'args': [
\ '--output-format=text',
\ '--msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg} [{msg_id}]"',
\ '--reports=no'
\ ],
\ 'errorformat':
\ '%A%f:%l:%c:%t: %m,' .
\ '%A%f:%l: %m,' .
\ '%A%f:(%l): %m,' .
\ '%-Z%p^%.%#,' .
\ '%-G%.%#',
\ 'output_stream': 'stdout',
\ 'postprocess': [
\ function('neomake#postprocess#generic_length'),
\ function('neomake#makers#ft#python#PylintEntryProcess'),
\ ]}
function! maker.filter_output(lines, context) abort
if a:context.source ==# 'stderr'
call filter(a:lines, "v:val !=# 'No config file found, using default configuration' && v:val !~# '^Using config file '")
endif
endfunction
return maker
endfunction
Maybe it is also a good idea to add numpy by default, as it is one of the most used Python packages.
Can it go into the pylintrc / config file?
Otherwise the following should work:
let g:neomake_python_pylint_args = neomake#makers#ft#python#pylint().args += ['--extension-pkg-whitelist=numpy']
There is some discussion / floating ideas about having a "post_args" setting or something similar, but nothing has been done in this regard yet.
This solution seems good enough for me.
Is it really supposed to be +=? If so then why?
In this case it looks indeed like something for the config file if this is possible. But the question remains relevant for me, as I usually want my automatic linter to be less strict, as they are mostly used for fast scripting.
So I like to disable plenty of stuff in Neovim, what should be checked in an explicit check.
+=
Whoops, should be + only of course.
I could imagine having something with neomake#config, e.g. neomake#config#append() which would append to an existing (default) setting, e.g. for your use case:
call neomake#config#append('python.pylint.args', ['--extension-pkg-whitelist=numpy'])
This could then get just saved internally, improving the current evaluation of the maker itself (because you are instantiating it).
I have some WIP to allow for :Neomake foo --add-args bar, but in your case it seems to be related to a default config only.
Any feedback on my previous comments/suggestions?
I think this should be closed, it is unnecessary since you can already do it globally and per buffer by overriding args
e.g. https://github.com/davidosomething/dotfiles/blob/dev/vim/autoload/dko/neomake/python.vim#L7-L8
I suggest adding this to docs
I've started working on an "append_args" setting in https://github.com/neomake/neomake/pull/2161 (just rebased it): please provide feedback there.