Pylance isn't showing errors
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.
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.
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.