This is a continuation of Try Visual Studio Code.
After that, if you set lint and let it check the grammar etc., it should be almost finished as an environment setting, but I will investigate how to set it so that pep8 can be called as homework. I will keep it.
As I wrote before, also named Python I have installed and enabled the extension called.
The original meaning of lint seems to be lint or something like that, but in short, it's like removing the lint from sewn clothes, or something like that. To put it simply, check the grammar like a mother-in-law.
When it comes to Python grammar and notation checks, there are commands such as pep8 and pylint that check whether the coding standard is PEP8 compliant.
This time, set up Visual Studio Code to call pylint.
I am building an environment with Anaconda, so install pylint as follows.
First, anaconda looks for packaged pylint.
% anaconda search -t conda pylint
Then anaconda / pylint seems to be a standard distribution.
% anaconda show anaconda/pylint
Using Anaconda API: https://api.anaconda.org
Name: pylint
Summary:
Access: public
Package Types: conda
Versions:
+ 1.2.0
+ 1.2.1
+ 1.1.0
+ 1.4.1
+ 1.4.0
+ 1.4.2
+ 1.3.1
+ 1.5.4
To install this package with conda run:
conda install --channel https://conda.anaconda.org/anaconda pylint
So I knew how to install it.
% conda install --channel https://conda.anaconda.org/anaconda pylint
In the anaconda environment, pep8 was already installed.
Make user settings for Visual Studio Code.
All you need to do to get lint to work and check every time you save a file is almost enough:
"python.linting.enabled": true
Or maybe this is the default, and pylint is running.
By the way, if you are a pep8 sect, just do the following.
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.linting.pep8Enabled": true
After that, I think that you can make the following settings as needed.
If you want to check every time you change the code, or if you want to check when saving the file, set the following items to true.
"python.linting.lintOnTextChange": true,
"python.linting.lintOnSave": true,
With the above, when writing Python code in Visual Studio Code, it is possible to check the grammar and notation method by lint.
takerushi pointed out.
For details, see the comments.
"python.linting.lintOnTextChange": true,
Seems to be abolished.