Search code examples
pythonvisual-studiovisual-studio-2015pylint

How can I add a pylint config file for Visual Studio 2015?


I've been using and loving the Python Tools for Visual Studio. https://www.visualstudio.com/en-us/features/python-vs.aspx New to Python, but I've been using VS for a very long time and it has been very quick to get up and running in the familiar environment.

I've used jslint before but just saw that there is pylint integration in VS 2015. It does exactly what I want and very happy with it. I would like to edit the config file for it and disable some of the warnings. I've searched high and low and unable to find any information about where the file goes that is specific to Visual Studio and what the name of the config file needs to be.

The jslint integration in VS had a right-click config section that you could alter the config file and mark certain variables as globals or hide other warnings. Does anyone know if you can do this for pylint? or what the file name and path should be to edit it manually?


Solution

  • Took awhile, but I found through trial and error that you can place a .pylintrc file in the project or solution folder and pylint will pick it up.

    To create this file, open a command window and type

    pylint --generate-rcfile > .pylintrc
    

    You can then move that file to the root folder of your project or solution.

    Other interesting thing I learned in this investigation is that Windows won't let you rename a file to start with a dot. You will get an error that says "You must type a file name." You can get around it by ending the filename with a dot as well. So name it .pylintrc. and Windows will remove the last dot and name it .pylintrc

    You want to add your message code to the list under [MESSAGE CONTROL] and disable= They made it easy by allowing you to use the number code (C0303) or the text version (trailing-whitespace)

    Great list of error codes and meanings can be found here http://pylint-messages.wikidot.com/all-codes