pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Pylance isn't showing errors

Open BrnMarq opened this issue 3 years ago • 1 comments

I recently installed pylance and pylint in Visual Studio Code, because I wanted to be enforced to follow a code style, but when I was testing it, I did realize that it doesn't show me a few errors that are actually documented in the github repo. Here's my settings.json file.

{
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode",
        "editor.codeActionsOnSave": {
            "source.fixAll.eslint": false
        }
    },
    "python.linting.pylintEnabled": true,
    "python.linting.enabled": true,
    "python.linting.pylintArgs": [
        "--rcfile",
        "${workspaceFolder}/.pylintrc"
    ],
    "[python]": {
        "editor.defaultFormatter": null
    },
    "python.analysis.diagnosticSeverityOverrides": { 
        "reportDuplicateImport" : "error",
    }
}

Here's the code that I'm trying to debug:

from datetime import date
from datetime import date

print(date)

I did test some more like the unused variable report, but it doesn't work either, if you need more information about my settings, ask for it.

BrnMarq avatar Mar 08 '22 04:03 BrnMarq

currently this is flagged as an unused import.. only if it was a single line 'from datetime import date, date' is it flagged as duplicate.

bschnurr avatar Jul 26 '22 21:07 bschnurr

This is by design. Pylance isn't a linter — that is, it's not designed to enforce coding styles.

If you want to enforce no duplicate imports from different import statements, a linter such as pylint may offer that functionality.

erictraut avatar Mar 25 '23 15:03 erictraut