1

I'm currently using ALE (recently upgraded to this from syntastic) and YCM for code completion, highlighting syntax errors on-the-fly (rather than just at save time, like with syntastic), and it's working great. However, I'd like to integrate more advanced linting beyond syntax errors and PEP8 compliance. For example, I'd like obvious coding mistakes like so to be hightlighted/announced:

# Beginning of .py file.
a = b # Should error-out, warning that `b` has not yet been defined.
a = 1

Are there any advanced linters for Python (and, optionally, C, C++, and go) that can be used to point out simple/obvious semantic errors either on-the-fly (i.e. via ALE) or whenever the file is saved (like with syntastic)?

I'm currently using vim from git on master on Ubuntu 18.04 LTS.

Thank you.

2
  • Im sorry, but i fail to see how a request for advanced static analyzers is (a) relevant to a vi/vim sight and (b) couldnt be solved by research
    – D. Ben Knoble
    Commented May 22, 2019 at 16:12
  • 4
    I'm voting to close this question as off-topic because it is not about vi/vim, but rather static analysis tools
    – D. Ben Knoble
    Commented May 22, 2019 at 16:13

1 Answer 1

1

It turns out this was easier than expected. It just boils down to installing the pip and apt packages for pylint and flake8, i.e.:

sudo apt install pylint
sudo apt install flake8
pip install pylint
pip install flake8

This of course needs to use pip-python3 instead of pip if you've configured YCM with Python3. From there, I just install the YCM and w0rp/ale packages via vundle.

The only caveat is that PEP8 (via flake8) errors will be rendered immediately, but other syntax errors detected by pylint will only be updated/re-rendered when the buffer is saved. However, there's an open issue on this topic, which is on the backlog to be resolved, as the underlying issue in pylint is now fixed, and we're now just waiting on an update to ale to support a plugin supplying buffers both via stdin and via file buffers.

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