Skip to content

Linting

Don Jayamanne edited this page Feb 15, 2016 · 32 revisions

#Linting Linting within the extension is supported on the following three:

  • Pylint (this is the default linter used)
  • pep8
  • flake8

###Paths All samples provided here are for windows.
However Mac/Linux paths are also supported.

Note: You could enable all of the above linters if necessary. Or just one or two of them.
This can be achieved by enabling/disabling individual linters.

Enable/Disable Linting

By default linting is enabled and uses pylint.
If you wish to turn this off, you could do so either in the User Settings or the Workspace Settings file.
Enabling/disabling could be done by configuring the following property in either one of (User or Workspace settings file) as follows:

"python.linting.enabled": true

The extension will run the linter as changes are made.
If this is deemed annoying, this can easily be turned off, once again either within the User or Workspace Settings files with the following configuration change:

"python.linting.lintOnTextChange": false

The extension will run the linter when ever a file is saved.
This can easily be turned off, once again either within the User or Workspace Settings files with the following configuration change:

"python.linting.lintOnSave": false

###Maximum number of messages The default maximum number of messages displayed in Visual Studio Code is limited to 100.
If this is to be altered, then change the following configuration settings either in the User or Workspace settings file:

"python.linting.maxNumberOfProblems": 50

###Pylint As mentioned previously, this is the default linter used by the extension.

Installing Pylint For this to work properly ensure pylint is installed locally.
You can easily install pylint as follows:
pip install pylint

Enabling/Disabling pylint If the pylint linter is not to be used by the extension, then disable it as follows either in the User or Workspace settings file:

"python.linting.pylintEnabled": false

Custom Path It is assumed that the path to pylint is set in the current path.
If this is not the case or you wish to use another version of pylint, all you need to do is configure the path as follows either in the User or Workspace settings file:

"python.linting.pylintPath": "c:/customPath/pylint.exe"

Pylint Category Mapping Messages generated by pylint fall into the following categories:

  • convention, refactor, warning, error, fatal
    Visual Studio Code supports the following categories in linting:
  • Hint, Error, Information, Warning By default the extension maps pylint "convention" to "Hint", and so on.
    These mappings can be altered either in the User or Workspace settings files as follows:
"python.linting.pylintCategorySeverity.convention": "Information"

###[Paths][paths]

Clone this wiki locally