When we lint our Python code with Neomake (using Pylint), it is often the case that our code can not pass the checker 100%. A lot of warnings and errors may occur, e.g., no docstring for method, variable names not conforming to standard. For some warnings, we do not want them to occur. How to ignore these warnings?

For example, if we want to ignore invalid-name(corresponding code is C0103) and missing-docstring( corresponding code C0111),we can use two methods.

Configure in the nvim config file

The first way is to configure through Nvim configuration file. Add the following settings to your Nvim configuration:

let g:neomake_python_pylint_maker = {
  \ 'args': [
  \ '-d', 'C0103, C0111',
  \ '-f', 'text',
  \ '--msg-template="{path}:{line}:{column}:{C}: [{symbol}] {msg}"',
  \ '-r', 'n'
  \ ],
  \ 'errorformat':
  \ '%A%f:%l:%c:%t: %m,' .
  \ '%A%f:%l: %m,' .
  \ '%A%f:(%l): %m,' .
  \ '%-Z%p^%.%#,' .
  \ '%-G%.%#',
  \ }

let g:neomake_python_enabled_makers = ['flake8', 'pylint']

Find the code corresponding to a warning and paste it in the string after -d options. Separate different warning codes with ,.

Configure in .pylintrc

The second way is to create a .pylintrc file and ignore certain warning in this file. First, we need to generate .pylintrc under the home directory:

pylint --disable=invalid-namae,missing-docstring --generate-rcfile > ~/.pylintrc

If you want to ignore new warnings, you just need to edit .pylintrc, find the part starting with disable= and add the new warnings to the long list of existing warnings. The format should conform to the existing format in the .pylintrc file.