Using Pylint to display error and warnings
You can use a ~/.pylintrc
file to configure Pylint - amongst other things, this allows you to ignore warnings you don't care about. If you must use tabs, tell Pylint by setting the indent-string
option to the tab character:
[FORMAT]
indent-string=\t
Pylint then will only warn you about places where you mix tabs and spaces - which you should never do, and keep an eye on in your code.
To disable other warnings, use Message Control to turn them off individually:
[MESSAGES CONTROL]
# C0111: Missing docstring
# R0904: Too many public methods
disable=C0111,R0904
For getting the IDs for the messages you're interested in, look at the "MESSAGES" section of your Pylint report, or see http://pylint-messages.wikidot.com/all-codes.
Also see the Message Control section in the Pylint docs, and the respective FAQ entry on How to find the option name for .pylintrc
corresponding to a specific command line option.
I'd really recommend to use a .pylintrc
, but for the sake of completeness, your other options are:
- annotate your sourcecode with hint comments for Pylint, e.g.
#pylint: disable=W0123,E4567
- call pylint with the respective command line options, e.g.
pylint --disable=W0702,C0103
PEP8's ideology is to use 4 spaces for an indentation.
You can tell your code editor or IDE to convert the tabs into spaces blocks.
For example, on Sublime 3:
-check the bottom status bar, click on 'Spaces'
-a menu pops out, click on "Convert Indentation to Spaces"
For tabs errors with SublimeLinter add:
"pep8_ignore":
[
"W191"
]
To:
[sublime data folder]\Packages\User\SublimeLinter.sublime-settings
Bonus, add:
"pep8": false
To the same file to ignore other pep8 errors like line length.
From the main menu select Preferences > Browse Packages to open the correct folder.