Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VScode/Python - Enable PEP8 Naming conventions

I went through multiple SO questions but couldn't find a solution for my problem. I am new to Python and following is my setup,

VSCode: version 1.45
Python : 3.8.2
Pylint: 2.5.3
autopep8: 1.5.3
pycodestyle: 2.6.0

With the above setup, if I want to enforce PEP8 naming conversions what should I do? The VScode documentation provide how to configure pydocstyleargs but it's documentation does not cover naming conventions.

I also looked at the things autopep8 fixes and can configure via "python.formatting.autopep8Args", it doesn't fix/report things like classes not having pascal-case

As mentioned by @PyWalker2797, I tried installing pep8 and enable it by setting "python.linting.pep8Enabled": true. But VSCode doesn't recognise it even after a restart of the application.

enter image description here

like image 872
Ishan Hettiarachchi Avatar asked Dec 21 '25 01:12

Ishan Hettiarachchi


1 Answers

I had the same problem.

If you read the documentation you will notice that the setting is not called pep8 but resides under the pydocstyle superset.

Thus, you have to use the following setting to enable checks on the variable conventions (and other stuff) from pep8:

"python.linting.pycodestyleEnabled": true,

like image 194
Haini Avatar answered Dec 24 '25 00:12

Haini