Pylint visual studio code как пользоваться
Visual Studio Code is a powerful editing tool for Python source code. The editor includes various features to help you be productive when writing code. For more information about editing in Visual Studio Code, see Basic Editing and Code Navigation.
In this overview, we will describe the specific editing features provided by the Python extension, including steps on how to customize these features via user and workspace settings.
Autocomplete and IntelliSense
IntelliSense is a general term for code editing features that relate to code completion. Take a moment to look at the example below. When print is typed, notice how IntelliSense populates auto-completion options. The user is also given a list of options when they begin to type the variable named, greeting.
Autocomplete and IntelliSense are provided for all files within the current working folder. They're also available for Python packages that are installed in standard locations.
Customize IntelliSense behavior
To customize the behavior of the analysis engine, see the Python extension code analysis settings and autocomplete settings.
You can also customize the general behavior of autocomplete and IntelliSense, even to disable these VS Code features entirely. See Customizing IntelliSense.
Tip: Check out the IntelliCode extension for VS Code (preview). IntelliCode provides a set of AI-assisted capabilities for IntelliSense in Python, such as inferring the most relevant auto-completions based on the current code context. For more information, see the IntelliCode for VS Code FAQ.
Enable IntelliSense for custom package locations
To enable IntelliSense for packages that are installed in other, non-standard locations, add those locations to the python.autoComplete.extraPaths collection in the settings file (the default collection is empty). For example, you might have installed Google App Engine installed in custom locations, specified in app.yaml if you use Flask. In this case, you'd specify those locations as follows:
Windows:
macOS/Linux:
For more on IntelliSense generally, see IntelliSense.
Troubleshooting IntelliSense
If autocomplete and IntelliSense aren't working for a custom module, check the following causes:
Cause | Solution |
---|---|
The path to the python interpreter is incorrect | Make sure you selected a valid interpreter path by running the Python: Select Interpreter command (see Environments). |
The custom module is located in a non-standard location (not installed using pip). | Add the location to the python.autoComplete.extraPaths setting and restart VS Code. |
Navigation
While editing, you can right-click different identifiers to take advantage of several convenient commands
Go to Definition ( F12 ) jumps from your code into the code that defines an object. This command is helpful when you're working with libraries.
Peek Definition ( ⌥F12 (Windows Alt+F12 , Linux Ctrl+Shift+F10 ) ), is similar, but displays the definition directly in the editor (making space in the editor window to avoid obscuring any code). Press Escape to close the Peek window or use the x in the upper right corner.
Go to Declaration jumps to the point at which the variable or other object is declared in your code.
Peek Declaration is similar, but displays the declaration directly in the editor. Again, use Escape or the x in the upper right corner to close the Peek window.
Quick Fixes
The add imports Quick Fix allows you to quickly complete import statements. First, begin by typing a package name within the editor. You will notice a Code Action is available to automatically complete the line of source code (as long as you have the module installed within the environment). Hover over the text (marked with a squiggle) and then select the Code Action light bulb when it appears. You can then select from a list of potential imports. Note: The functionality in the below examples is provided by the Pylance language server.
The add imports Code Action also recognizes some of the popular abbreviations for the following common Python packages: numpy as np, tensorflow as tf, pandas as pd, matplotlib.pyplot as plt, matplotlib , as mpl, math as m, scipi.io as spio, and scipy as sp, panel as pn, and holoviews as hv.
The import suggestions list is ordered with import statements for packages (or modules) at the top. It will also include statements for more modules and/or members (classes, objects, etc.) from specified packages.
Run Selection/Line in Terminal (REPL)
The Python: Run Selection/Line in Python Terminal command ( Shift+Enter ) is a simple way to take whatever code is selected, or the code on the current line if there is no selection, and run it in the Python Terminal. An identical Run Selection/Line in Python Terminal command is also available on the context menu for a selection in the editor.
VS Code automatically removes indents based on the first non-empty line of the selection, shifting all other lines left when needed.
Source code that runs in the terminal/REPL is cumulative until the current instance of the terminal is closed.
The command opens the Python Terminal if necessary; you can also open the interactive REPL environment directly using the Python: Start REPL command. (Initial startup might take a few moments especially if the first statement you run is an import .)
On first use of the Python: Run Selection/Line in Python Terminal command, VS Code may send the text to the REPL before that environment is ready, in which case the selection or line isn't run. If you come across this behavior, try the command again when the REPL has finished loading.
Formatting
Formatting makes code easier to read by human beings. It applies specific rules and conventions for line spacing, indents, spacing around operators, and so on. You can view an example on the autopep8 page. Keep in mind, formatting doesn't affect the functionality of the code itself.
Linting helps to prevent errors by analyzing code for common syntactical, stylistic, and functional errors and unconventional programming practices. Although there is a little overlap between formatting and linting, the two capabilities are complementary.
The Python extension supports source code formatting using either autopep8 (the default), black, or yapf.
General formatting settings
Setting (python.formatting.) | Default value | Description |
---|---|---|
provider | "autopep8" | Specifies the formatter to use, either "autopep8", "yapf", or "black". |
Formatter-specific settings
The following settings apply to the individual formatters. The Python extension looks for the formatter in the selected interpreter. To use a formatter in another location, specify that location in the appropriate custom path setting. The pip install commands may require elevation.
Formatter | Install steps | Arguments setting (python.formatting.) | Custom path setting (python.formatting.) |
---|---|---|---|
autopep8 | pip install pep8 pip install --upgrade autopep8 | autopep8Args | autopep8Path |
black (see note) | pip install black | blackArgs | blackPath |
yapf | pip install yapf | yapfArgs | yapfPath |
Note: By default, the Black formatter can't be installed when a Python 2 environment is active. Attempting to do so may display the message "Formatter black is not installed. Install?". If you try to install Black in response, another message appears saying "Could not find a version that satisfies the requirement black' No matching distribution found for black."
To work around this issue and use the Black formatter with Python 2, first install Black in a Python 3 environment. Then set the python.formatting.blackPath setting to that install location.
When using custom arguments, each top-level element of an argument string that's separated by space on the command line must be a separate item in the args list. For example:
In the second example, the top-level element is a single value contained in braces, so the spaces within that value don't delineate a separate element.
Troubleshooting formatting
If formatting fails, check the following possible causes:
Cause | Solution |
---|---|
The path to the python interpreter is incorrect. | Make sure you selected a valid interpreter path by running the Python: Select Interpreter command. |
The formatter is not installed in the current environment. | Open a command prompt, navigate to the location where your selected interpreter is, and run pip install for the formatter. |
The path to the formatter is incorrect. | Check the value of the appropriate python.formatting.Path setting. |
Custom arguments for the formatter are incorrect. | Check that the appropriate python.formatting.Path setting does not contain arguments, and that python.formatting.Args contains a list of individual top-level argument elements such as "python.formatting.yapfArgs": ["--style", ""] . |
Pop up with warning message Black does not support the "Format Select" command. | black does not support formatting sections of code, it can be prevented with the following settings "[python]": . |
Refactoring
The Python extension adds the following refactoring functionalities: Extract Variable, Extract Method, Rename Module, and Sort Imports.
Extract Variable
Extracts all similar occurrences of the selected text within the current scope, and replaces it with a new variable.
You can invoke this command by selecting the line of code you wish to extract as a variable. Then select the light-bulb that is displayed next to it.
Extract Method
Extracts all similar occurrences of the selected expression or block within the current scope, and replaces it with a method call.
You can invoke this command by selecting the lines of code you wish to extract as a method. Then select the light-bulb that is displayed next to it.
Rename Module
After a Python file/module is renamed, Pylance can find all instances that may need to be updated and provide you with a preview of all the changes.
To customize which references need to be updated, you can toggle the checkboxes at the line or from the file level in Refactor Preview. Once you've made your selections, you can select Apply Refactoring or Discard Refactoring.
Sort Imports
Sort Imports uses the isort package to consolidate specific imports from the same module into a single import statement and to organize import statements in alphabetical order.
- Right-click in editor and select Sort Imports (no selection is required)
- Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P ) ), then Python Refactor: Sort Imports
- Assign a keyboard shortcut to the python.sortImports command
Custom arguments to isort are specified in the python.sortImports.args setting, where each top-level element, as separated by spaces on the command line, is a separate item in the array:
To use a custom isort script, use the python.sortImports.path setting to specify the path.
Further configurations can be stored in an .isort.cfg file as documented on isort configuration.
Note: For those migrating from isort4 to isort5, some CLI flags and config options have changed, refer to the project's isort5 upgrade guide.
Working with Python in Visual Studio Code, using the Microsoft Python extension, is simple, fun, and productive. The extension makes VS Code an excellent Python editor, and works on any operating system with a variety of Python interpreters. It leverages all of VS Code's power to provide auto complete and IntelliSense, linting, debugging, and unit testing, along with the ability to easily switch between Python environments, including virtual and conda environments.
This article provides only an overview of the different capabilities of the Python extension for VS Code. For a walkthrough of editing, running, and debugging code, use the button below.
Install Python and the Python extension
Once you have a version of Python installed, activate it using the Python: Select Interpreter command. If VS Code doesn't automatically locate the interpreter you're looking for, refer to Environments - Manually specify an interpreter.
You can configure the Python extension through settings. Learn more in the Python Settings reference.
Windows Subsystem for Linux: If you are on Windows, WSL is a great way to do Python development. You can run Linux distributions on Windows and Python is often already installed. When coupled with the Remote - WSL extension, you get full VS Code editing and debugging support while running in the context of WSL. To learn more, go to Developing in WSL or try the Working in WSL tutorial.
Run Python code
To experience Python, create a file (using the File Explorer) named hello.py and paste in the following code:
The Python extension then provides shortcuts to run Python code in the currently selected interpreter (Python: Select Interpreter in the Command Palette):
- In the text editor: right-click anywhere in the editor and select Run Python File in Terminal. If invoked on a selection, only that selection is run.
- In Explorer: right-click a Python file and select Run Python File in Terminal.
You can also use the Terminal: Create New Terminal command to create a terminal in which VS Code automatically activates the currently selected interpreter. See Environments below. The Python: Start REPL activates a terminal with the currently selected interpreter and then runs the Python REPL.
For a more specific walkthrough on running code, see the tutorial.
Autocomplete and IntelliSense
The Python extension supports code completion and IntelliSense using the currently selected interpreter. IntelliSense is a general term for a number of features, including intelligent code completion (in-context method and variable suggestions) across all your files and for built-in and third-party modules.
IntelliSense quickly shows methods, class members, and documentation as you type, and you can trigger completions at any time with ⌃Space (Windows, Linux Ctrl+Space ) . You can also hover over identifiers for more information about them.
Tip: Check out the IntelliCode extension for VS Code (preview). IntelliCode provides a set of AI-assisted capabilities for IntelliSense in Python, such as inferring the most relevant auto-completions based on the current code context.
Linting
Linting analyzes your Python code for potential errors, making it easy to navigate to and correct different problems.
The Python extension can apply a number of different linters including Pylint, pycodestyle, Flake8, mypy, pydocstyle, prospector, and pylama. See Linting.
Debugging
No more print statement debugging! Set breakpoints, inspect data, and use the debug console as you run your program step by step. Debug a number of different types of Python applications, including multi-threaded, web, and remote applications.
For Python-specific details, including setting up your launch.json configuration and remote debugging, see Debugging. General VS Code debugging information is found in the debugging document. The Django and Flask tutorials also demonstrate debugging in the context of those web apps, including debugging Django page templates.
Environments
The Python extension automatically detects Python interpreters that are installed in standard locations. It also detects conda environments as well as virtual environments in the workspace folder. See Configuring Python environments.
The current environment is shown on the left side of the VS Code Status Bar:
The Status Bar also indicates if no interpreter is selected:
The selected environment is used for IntelliSense, auto-completions, linting, formatting, and any other language-related feature other than debugging. It is also activated when you use run Python in a terminal.
To change the current interpreter, which includes switching to conda or virtual environments, select the interpreter name on the Status Bar or use the Python: Select Interpreter command.
VS Code prompts you with a list of detected environments as well as any you've added manually to your user settings (see Configuring Python environments).
Installing packages
Packages are installed using the Terminal panel and commands like pip install (Windows) and pip3 install (macOS/Linux). VS Code installs that package into your project along with its dependencies. Examples are given in the Python tutorial as well as the Django and Flask tutorials.
Jupyter notebooks
If you open a Jupyter notebook file ( .ipynb ) in VS Code, you can use the Jupyter Notebook Editor to directly view, modify, and run code cells.
Opening a notebook as a Python file allows you to use all of VS Code's debugging capabilities. You can then save the notebook file and open it again as a notebook in the Notebook Editor, Jupyter, or even upload it to a service like Azure Notebooks.
Using either method, Notebook Editor or a Python file, you can also connect to a remote Jupyter server for running the code. For more information, see Jupyter support.
Testing
The Python extension supports testing with unittest and pytest.
To run tests, you enable one of the frameworks in settings. Each framework also has specific settings, such as arguments that identify paths and patterns for test discovery.
Once discovered, VS Code provides a variety of commands (on the Status Bar, the Command Palette, and elsewhere) to run and debug tests, including the ability to run individual test files and individual methods.
Configuration
The Python extension provides a wide variety of settings for its various features. These are described on their relevant topics, such as Editing code, Linting, Debugging, and Testing. The complete list is found in the Settings reference.
Other popular Python extensions
The Microsoft Python extension provides all of the features described previously in this article. Additional Python language support can be added to VS Code by installing other popular Python extensions.
- Open the Extensions view ( ⇧⌘X (Windows, Linux Ctrl+Shift+X ) ).
- Filter the extension list by typing 'python'.
The extensions shown above are dynamically queried. Click on an extension tile above to read the description and reviews to decide which extension is best for you. See more in the Marketplace.
Linting highlights syntactical and stylistic problems in your Python source code, which often helps you identify and correct subtle programming errors or unconventional coding practices that can lead to errors. For example, linting detects use of an uninitialized or undefined variable, calls to undefined functions, missing parentheses, and even more subtle issues such as attempting to redefine built-in types or functions. Linting is thus distinct from Formatting because linting analyzes how the code runs and detects errors whereas formatting only restructures how code appears.
Note: Stylistic and syntactical code detection is enabled by the Language Server. To enable third-party linters for additional problem detection, you can enable them by using the Python: Select Linter command and selecting the appropriate linter.
Enable linting
To enable linters, open the Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P ) ) and select the Python: Select Linter command. The Select Linter command adds "python.linting.Enabled": true to your settings, where is the name of the chosen linter. See Specific linters for details.
Enabling a linter prompts you to install the required packages in your selected environment for the chosen linter.
Note: If you're using a global environment and VS Code is not running elevated, linter installation may fail. In that case, either run VS Code elevated, or manually run the Python package manager to install the linter at an elevated command prompt for the same environment: for example sudo pip3 install pylint (macOS/Linux) or pip install pylint (Windows, at an elevated prompt).
Disable linting
You can easily toggle between enabling and disabling your linter. To switch, open the Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P ) ) and select the Python: Enable/Disable Linting command.
This will populate a dropdown with the current linting state and options to Enable or Disable Python linting.
Run linting
To perform linting, open the Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P ) ), filter on "linting", and select Python: Run Linting. Linting will run automatically when you save a file.
Issues are shown in the Problems panel and as wavy underlines in the code editor. Hovering over an underlined issue displays the details:
General linting settings
You can add any of the linting settings to your user settings.json file (opened with the File > Preferences > Settings command ⌘, (Windows, Linux Ctrl+, ) ). Refer to User and Workspace settings to find out more about working with settings in VS Code.
To change the linting behavior across all enabled linters, modify the following settings:
Feature | Setting (python.linting.) | Default value |
---|---|---|
Linting in general | enabled | true |
Linting on file save | lintOnSave | true |
Maximum number of linting messages | maxNumberOfProblems | 100 |
Exclude file and folder patterns | ignorePatterns | [".vscode/*.py", "**/site-packages/**/*.py"] |
When enabling lintOnSave , you might also want to enable the generic files.autoSave option (see Save / Auto Save). The combination provides frequent linting feedback in your code as you type.
Specific linters
The following table provides a summary of available Python linters and their basic settings. For descriptions of individual settings, see the Linter settings reference.
Linter | Package name for pip install command | True/false enable setting (python.linting.) | Arguments setting (python.linting.) | Custom path setting (python.linting.) |
---|---|---|---|---|
Pylint | pylint | pylintEnabled | pylintArgs | pylintPath |
Flake8 | flake8 | flake8Enabled | flake8Args | flake8Path |
mypy | mypy | mypyEnabled | mypyArgs | mypyPath |
pycodestyle (pep8) | pycodestyle | pycodestyleEnabled | pycodestyleArgs | pycodestylePath |
prospector | prospector | prospectorEnabled | prospectorArgs | prospectorPath |
pylama | pylama | pylamaEnabled | pylamaArgs | pylamaPath |
bandit | bandit | banditEnabled | banditArgs | banditPath |
To select a different linter, use the Python: Select Linter command. You can also edit your settings manually to enable multiple linters. Note, that using the Select Linter command overwrites those edits.
Custom arguments are specified in the appropriate arguments setting for each linter. Each top-level element of an argument string that's separated by a space on the command line must be a separate item in the args list. For example:
If a top-level element is a single value (delineated by quotation marks or braces), it still appears as a single item in the list even if the value itself contains spaces.
A custom path is generally unnecessary as the Python extension resolves the path to the linter based on the Python interpreter being used (see Environments). To use a different version of a linter, specify its path in the appropriate custom path setting. For example, if your selected interpreter is a virtual environment but you want to use a linter that's installed in a global environment, then set the appropriate path setting to point to the global environment's linter.
Note: The following sections provide additional details for the individual linters linked in the Specific linters table above. In general, custom rules must be specified in a separate file as required by the linter you're using.
Pylint
Pylint messages fall into the categories in the following table with the indicated mapping to VS Code categories. You can change the setting to change the mapping.
Pylint category | Description | VS Code category mapping | Applicable setting (python.linting.) |
---|---|---|---|
Convention (C) | Programming standard violation | Information (underline) | pylintCategorySeverity.convention |
Refactor (R) | Bad code smell | Hint (light bulbs) | pylintCategorySeverity.refactor |
Warning (W) | Python-specific problems | Warning | pylintCategorySeverity.warning |
Error (E) | Likely code bugs | Error (underline) | pylintCategorySeverity.error |
Fatal (F) | An error prevented further Pylint processing | Error | pylintCategorySeverity.fatal |
Command-line arguments and configuration files
You can easily generate an options file using different methods. See Pylint command-line arguments for general switches.
If you're using command-line arguments:
Command-line arguments can be used to load Pylint plugins, such as the plugin for Django:
If you're using a pylintrc file:
Options can also be specified in a pylintrc or .pylintrc options file in the workspace folder, as described on Pylint command line arguments.
To control which Pylint messages are shown, add the following contents to an options file:
If you're using Pylint:
You can create an options file using Pylint itself, by running the command below.
If you are running Pylint in PowerShell, you have to explicitly specify a UTF-8 output encoding. This file contains sections for all the Pylint options, along with documentation in the comments.
pydocstyle
Command-line arguments and configuration files
See pydocstyle Command Line Interface for general options. For example, to ignore error D400 (first line should end with a period), add the following line to your settings.json file:
A code prefix also instructs pydocstyle to ignore specific categories of errors. For example, to ignore all Docstring Content issues (D4XXX errors), add the following line to settings.json :
More details can be found in the pydocstyle documentation.
Options can also be read from a [pydocstyle] section of any of the following configuration files:
- setup.cfg
- tox.ini
- .pydocstyle
- .pydocstyle.ini
- .pydocstylerc
- .pydocstylerc.ini
For more information, see Configuration Files.
Message category mapping
The Python extension maps all pydocstyle errors to the Convention (C) category.
pycodestyle (pep8)
Command-line arguments and configuration files
See pycodestyle example usage and output for general switches. For example, to ignore error E303 (too many blank lines), add the following line to your settings.json file:
pycodestyle options are read from the [pycodestyle] section of a tox.ini or setup.cfg file located in any parent folder of the path(s) being processed. For details, see pycodestyle configuration.
Message category mapping
The Python extension maps pycodestyle message categories to VS Code categories through the following settings. If desired, change the setting to change the mapping.
pycodestyle category | Applicable setting (python.linting.) | VS Code category mapping |
---|---|---|
W | pycodestyleCategorySeverity.W | Warning |
E | pycodestyleCategorySeverity.E | Error |
Prospector
Command-line arguments and configuration files
See Prospector Command Line Usage for general options. For example, to set a strictness level of "very high," add the following line to your settings.json file:
It's common with Prospector to use profiles to configure how Prospector runs. By default, Prospector loads the profile from a .prospector.yaml file in the current folder.
Because Prospector calls other tools, such as Pylint, any configuration files for those tools override tool-specific settings in .prospector.yaml . For example, suppose you specify the following, in .prospector.yaml :
If you also have a .pylintrc file that enables the too-many-arguments warning, you continue to see the warning from Pylint within VS Code.
Message category mapping
The Python extension maps all Prospector errors and warnings to the Error (E) category.
Flake8
Command-line arguments and configuration files
See Invoking Flake8 for general switches. For example, to ignore error E303 (too many blank lines), use the following setting:
By default, Flake8 ignores E121, E123, E126, E226, E24, and E704.
Flake8 user options are read from the C:\Users\\.flake8 (Windows) or ~/.config/flake8 (macOS/Linux) file.
At the project level, options are read from the [flake8] section of a tox.ini , setup.cfg , or .flake8 file.
Message category mapping
The Python extension maps flake8 message categories to VS Code categories through the following settings. If desired, change the setting to change the mapping.
Flake8 category | Applicable setting (python.linting.) | VS Code category mapping |
---|---|---|
F | flake8CategorySeverity.F | Error |
E | flake8CategorySeverity.E | Error |
W | flake8CategorySeverity.W | Warning |
Message category mapping
The Python extension maps mypy message categories to VS Code categories through the following settings. If desired, change the setting to change the mapping.
Широко распространенное средство PyLint позволяет искать ошибки в коде Python и поощряет правильные методы создания кода Python. Это средство интегрируется в проекты Python для Visual Studio.
Выполнить PyLint
Щелкните правой кнопкой мыши проект Python в обозревателе решений и выберите Python > Выполнить PyLint:
При запуске этой команды вы увидите предложение установить PyLint в вашем окружении, если это еще не сделано.
Предупреждения и ошибки PyLint отображаются в окне Список ошибок:
Дважды щелкнув ошибку, вы перейдете к тому участку исходного кода, в котором она возникла.
Настройка параметров командной строки PyLint
В разделе документации PyLint, посвященном параметрам командной строки, описывается управление поведением PyLint с помощью файла конфигурации .pylintrc. Этот файл можно разместить в корне проекта Python в Visual Studio или в другом месте в зависимости от того, где нужно применять эти параметры (подробные сведения см. в описании параметров командной строки).
Например, с помощью файла .pylintrc можно отключить для проекта предупреждения "отсутствует docstring", представленное на изображении выше. Для этого сделайте следующее:
В командной строке перейдите в корневой каталог проекта (где находится файл .pyproj) и выполните следующую команду, чтобы создать файл конфигурации с заметками:
В обозревателе решений Visual Studio щелкните проект правой кнопкой мыши, выберите Добавить > Существующий элемент, затем найдите и выберите только что созданный файл .pylintrc и выберите команду Добавить.
Сохраните файл .pylintrc, снова запустите PyLint и убедитесь, что предупреждения больше не появляются.
Для использования файла .pylintrc из сетевой папки создайте переменную среды с именем PYLINTRC и присвойте ей в качестве значения имя файла в сетевой папке с указанием UNC-пути или буквы подключенного диска. Например, PYLINTRC=\\myshare\python\.pylintrc .
PyLint, a widely used tool that checks for errors in Python code and encourages good Python coding patterns, is integrated into Visual Studio for Python projects.
Run PyLint
Just right-click a Python project in Solution Explorer and select Python > Run PyLint:
Using this command prompts you to install PyLint into your active environment if it's not already present.
PyLint warnings and errors appear in the Error List window:
Double-clicking an error takes you directly to the source code that generated the issue.
See the PyLint features reference for a detailed list of all the PyLint output messages.
Set PyLint command-line options
The command-line options section of the PyLint documentation describes how to control PyLint's behavior through a .pylintrc configuration file. Such a file can be placed in the root of a Python project in Visual Studio or elsewhere depending on how widely you want those settings applied (see the command-line options for details).
For example, to suppress the "missing docstring" warnings shown in the previous image with a .pylintrc file in a project, do the steps:
On the command line, navigate to your project root (which has your .pyproj file) and run the following command to generate a commented configuration file:
In Visual Studio Solution Explorer, right-click your project, select Add > Existing Item, navigate to the new .pylintrc file, select it, and select Add.
Open the file for editing, which has several settings you can work with. To disable a warning, locate the [MESSAGES CONTROL] section, then locate the disable setting in that section. There's a long string of specific messages, to which you can append whichever warnings you want. In the example here, append ,missing-docstring (including the delineating comma).
Save the .pylintrc file and run PyLint again to see that the warnings are now suppressed.
To use a .pylintrc file from a network share, create an environment variable named PYLINTRC with the value of the filename on the network share using a UNC path or a mapped drive letter. For example, PYLINTRC=\\myshare\python\.pylintrc .
Читайте также: