Check Python 3 source with Pylint running with Python 2

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-03 17:27:06

问题


Some checks of Pylint are depending on whether the checked source code is of kind Python 2 or Python 3. E.g., see How to avoid Pylint warnings for constructor of inherited class in Python 3?.

In my setup I run Pylint on a development server, which is using Python 2.7. However, I use Pylint to automatically check Python 3 code on each commit.

How can I configure Pylint to perform checking for Python 3, even if it runs under Python 2?


回答1:


Short answer: you can't.

Pylint is using the builtin Python parser, and also get standard library information on demand, so the Python version running Pylint has a high impact on its output.

You should have several Pylint installations if you want to use it to check both Python 2 and Python 3 code.




回答2:


You can install pylint using pip3

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


来源:https://stackoverflow.com/questions/22309636/check-python-3-source-with-pylint-running-with-python-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!