pythonvisual-studio-codepylint

Pylint Gives Different Results in VS Code and CLI


Pylint provides different results when run in VS Code compared to the command line interface. I get the following warnings in the CLI, but they don't appear in VS Code:

  1. pages/home.py:388:0: R0914: Too many local variables (22/15) (too-many-locals)
  2. pages/home.py:446:4: R1705: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it (no-else-return)
  3. components/element_builder.py:125:0: R0912: Too many branches (14/12) (too-many-branches)

Both environments are using the same versions:

The CLI command I'm running is: pylint $(git ls-files '*.py')

My VS Code settings look as follows: VS Code Settings Page

I was expecting the VS Code and the CLI to return the exact same result because they are running the same version of pylint and the VS Code settings appear neutral.

How can I get pylint to return the same results in VS Code and the CLI?


Solution

  • Ensure that your pylint is working properly in vscode,

    Please try adding the following codes to your settings.json:

    "python.linting.pylintEnabled": true,  
    "python.linting.enabled": true,