4

I recently switched to Neovim and was trying to install the code checking plugin 'Neomake'. I followed the instructions for the setup in my vimrc. The plugin seems to run fine but the error list was not populated with errors even when I put in intentional errors.

A section of my vimrc:

let g:neomake_python_flake8_maker = {
    \ 'exe': 'python3.4',
    \ 'errorformat': '%A%f: line %l\, col %v\, %m \ (%t%*\d\)',
    \ }
let g:neomake_python_enable_makers = ['flake8']

So how can I setup neomake properly with Python 2/3 support? Preferably using Flake8 as the checker.

  • 1
    flake8 is not very effective in finding bugs. Personally I prefer pylint. – Chong May 17 '16 at 18:30
  • Thanks, I tried the other ones and pyflakes seems to work pretty well, will try pylint later. This is strange as flake8 works very well back in Vim with synastic. – tommyip May 17 '16 at 18:33
  • If your code is interpreted as Python3 and you want to use Python2 version of Pylint, use g:neomake_python_pylint_exe = 'pylint2' in your settings. Replacing pylint2 to the name of your checker binary. Refer for more information: github.com/neomake/neomake/issues/340 – Chong May 17 '16 at 18:34
  • 1
    How are you confirming that Neomake isn't working? Also, I have to disagree with @Chong about pylint. It doesn't seem to work with virtualenvs, and it's too opinionated for in-editor coding. The linter should catch conformance issues while I'm working, not break my focus because something could be better. I would definitely use pylint for reviewing code before large commits to spot potential issues quickly, but I wouldn't want it to be the automated authority on what's passable. – Tommy A May 18 '16 at 2:36
  • Did you have any success in solving this? – arsenbonbon Aug 10 '16 at 8:44
4

I just had the same problem as soon as I started adding options, I had to copy the error format from the plugin code to my options:

let g:neomake_python_flake8_maker = {
    \ 'args': ['--ignore=E221,E241,E272,E251,W702,E203,E201,E202',  '--format=default'],
    \ 'errorformat':
        \ '%E%f:%l: could not compile,%-Z%p^,' .
        \ '%A%f:%l:%c: %t%n %m,' .
        \ '%A%f:%l: %t%n %m,' .
        \ '%-G%.%#',
    \ }
let g:neomake_python_enabled_makers = ['flake8']
2

In my case I setup all my dev environments like a virtualenv, using pyenv. For errors and warnings, I put pylama inside my virtualenv (come in my requirements.txt) and pylama requires mccabe, pep257, pep8 and pyflakes. All this are probed by neomake.

With this setup, pylama give me alerts from all these integrated, no extra settings needed. But I must remember to always have active the virtualenv before running neovim for the IDE to work.

UPDATE: you can check here:

https://github.com/neomake/neomake/blob/master/autoload/neomake/makers/ft/python.vim

that pylama is supported by pymake for default.

  • It doesn't look like pylama integrates into vim/neovim automatically. Do you have an example for setting up pylama with neomake? As it stands, this doesn't seem to answer the question. – John O'M. Aug 17 '16 at 14:28
  • 1
    @JohnO'M. pylama is supported by default for neomake, check the update – Yonsy Solis Aug 18 '16 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.