Check Python 3 source with Pylint working with Python 2

Some Pylint checks depend on whether the verified source code is some kind of Python 2 or Python 3. For example, see How to avoid Pylint warnings for the constructor of an inherited class in Python 3? .

In my setup, I run Pylint on a development server that uses Python 2.7. However, I use Pylint to automatically check Python 3 code with every commit.

How to configure Pylint to test in Python 3, even if it works under Python 2?

+3
source share
2 answers

Short answer: you cannot.

Pylint uses the built-in Python analyzer and also receives standard library information upon request, so the version of Python running Pylint has a big impact on its output.

You must have several Pylint installations if you want to use them to test Python 2 and Python 3 code.

+8
source

You can install pylint using pip3

sudo apt-get install python3-pip sudo pip3 install pylint 
0
source

All Articles