JC_CL
JC_CL

Reputation: 2608

VSCode can't find (some) pylint modules

This was a very simple user error that has nothing to do with importing modules for pylint.

However, since it appears to me like others could fall for that mistake, I'm leaving that question online. Maybe it'll help someone else.

I'm using Visual Studio Code with pylint, and it seems to work mostly, showing me messages like Variable name "Lat" doesn't conform to snake_case naming style, Trailing whitespace and quite a few more other categories, so it seems to work. Mostly, that is.

Right at the beginning it also tells me No module named pylintCategorySeverity.convention and No module named pylintCategorySeverity.refactor, both of which I'd very much like to have.

How do I enable them? According to the documentation it seems like I simply have to add them to Python › Linting: Pylint Args in settings, or do it directly in settings.json. And there I've got

    "python.linting.pylintArgs": [
        "pylintCategorySeverity.convention",
        "pylintCategorySeverity.refactor"
    ]

which looks OK to me.

So what is my problem? I'd assume they're simply not installed, but neither pip nor conda can find a package that seems to fit. Or did they get renamed and I'm either running an old version or the documentation is too old?

Upvotes: 0

Views: 236

Answers (1)

TwoBytesShort
TwoBytesShort

Reputation: 121

Convention and refactor are not modules of/for PyLint, but categorises of problems that PyLint will report. The snake case naming style message you are receiving is part of the convention category. Therefore if you are receiving this message then you are already have PyLint checking for this category of problem.

Each of the categorises of problems reported by PyLint is mapped to a different error level in VSCode. The configuration options specify what level each category will be report as in VSCode. So for example the line:

def someFuntion():

Would normally report as an information level problem. However if I include in the settings:

"python.linting.pylintCategorySeverity.convention": "Error"

Then this will now report as an error. The table at documentation describes the default level each problem is report at. To increase the number of checks that are run ensure that you have the following in your settings file:

"python.linting.pylintUseMinimalCheckers": false,

Upvotes: 1

Related Questions