question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optional pylint Plugins not Linting in VSCode

See original GitHub issue

Issue Type: Bug

Please also see https://github.com/microsoft/pylance-release/issues/3003

Environment data

  • Language Server version: 1.68.1
  • OS and version: Windows 10, x64-bit
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.10 (CPython)

Code Snippet

Pylint optional plugins display messages in the OUTPUT tab, but do not lint in VSCode

Repro Steps

pyproject.toml

[tool.pylint.main]
extension-pkg-allow-list = [
    "PyQt5",
    "PyQt6",
    "PySide2",
    "PySide6",
]
fail-under = 10
ignore = [
    ".venv",
]
# `generate_pyi.py` is from KitWare VTK library
ignore-paths = [
    "stubs/vtkmodules-stubs/generate_pyi.py",
]
load-plugins = [
    "pylint.extensions.bad_builtin",
    "pylint.extensions.broad_try_clause",
    "pylint.extensions.check_elif",
    "pylint.extensions.consider_ternary_expression",
    "pylint.extensions.docparams",
    "pylint.extensions.empty_comment",
    "pylint.extensions.redefined_loop_name",
    "pylint.extensions.while_used",
    "pylint.extensions.for_any_all",
    "pylint.extensions.no_self_use",
    "pylint.extensions.set_membership",
]

[tool.pylint."messages control"]
confidence = []
disable = [
    "too-few-public-methods",
    "too-many-arguments",
    "too-many-instance-attributes",
    "useless-import-alias",
]

[tool.pylint.parameter_documentation]
default-docstring-type = "google"

settings.json

{
    "python.analysis.diagnosticMode": "openFilesOnly",
    "python.analysis.diagnosticSeverityOverrides": {
        "reportImportCycles": "none",
        "reportPrivateImportUsage": "information",
        "reportUnnecessaryIsInstance": "none"
    },
    "python.analysis.typeCheckingMode": "off",
    "python.defaultInterpreterPath": "${workspaceFolder}/.venv/Scripts/python.exe",
    "python.formatting.provider": "black",
    "python.languageServer": "Pylance",
    "python.linting.banditArgs": [
        "--configfile=pyproject.toml"
    ],
    "python.linting.banditEnabled": true,
    "python.linting.banditPath": "${workspaceFolder}/.venv/Scripts/bandit.exe",
    "python.linting.flake8Enabled": true,
    "python.linting.flake8Path": "${workspaceFolder}/.venv/Scripts/flake8.exe",
    "python.linting.ignorePatterns": [
        ".vscode/**/*.py",
        ".venv/**/*.py",
        "stubs/**/*.pyi"
    ],
    "python.linting.mypyArgs": [
        "--config-file=pyproject.toml"
    ],
    "python.linting.mypyEnabled": true,
    "python.linting.mypyPath": "${workspaceFolder}/.venv/Scripts/mypy.exe",
    "python.linting.pydocstyleArgs": [
        "--convention=google"
    ],
    "python.linting.pydocstyleEnabled": true,
    "python.linting.pylintArgs": [
        "--rcfile=pyproject.toml"
    ],
    "python.linting.pylintEnabled": true,
    "python.linting.pylintPath": "${workspaceFolder}/.venv/Scripts/pylint.exe",
}

Logs

OUTPUT Tab (Python)

> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.8.1\pythonFiles\sortImports.py - --diff
cwd: .\myproj
> .\.venv\Scripts\python.exe -m black --config=pyproject.toml --diff --quiet .\myproj\widgets.py
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.8.1\pythonFiles\linter.py -p bandit ./.venv/Scripts/bandit.exe --configfile=pyproject.toml .\myproj\widgets.py
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.8.1\pythonFiles\linter.py -p flake8 ./.venv/Scripts/flake8.exe .\myproj\widgets.py
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.8.1\pythonFiles\linter.py -p mypy ./.venv/Scripts/mypy.exe --config-file=pyproject.toml .\myproj\widgets.py
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.8.1\pythonFiles\linter.py -p pylint ./.venv/Scripts/pylint.exe --rcfile=pyproject.toml .\myproj\widgets.py
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.8.1\pythonFiles\linter.py -m pydocstyle --convention=google .\myproj\widgets.py
cwd: .
> .\.venv\Scripts\python.exe ~\.vscode\extensions\ms-python.python-2022.8.1\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear ./tests
cwd: .
##########Linting Output - pydocstyle##########


##########Linting Output - bandit##########


##########Linting Output - flake8##########


##########Linting Output - mypy##########

Success: no issues found in 1 source file

##########Linting Output - pylint##########

[
    {
        "type": "refactor",
        "module": "myproj.widgets",
        "obj": "_CollapsibleWrapper.__init__",
        "line": 80,
        "column": 30,
        "endLine": 80,
        "endColumn": 44,
        "path": "myproj\\widgets.py",
        "symbol": "use-set-for-membership",
        "message": "Consider using set for membership test",
        "message-id": "R6201"
    },
    {
        "type": "refactor",
        "module": "myproj.widgets",
        "obj": "_CollapsibleWrapper.content_size",
        "line": 133,
        "column": 35,
        "endLine": 133,
        "endColumn": 49,
        "path": "myproj\\widgets.py",
        "symbol": "use-set-for-membership",
        "message": "Consider using set for membership test",
        "message-id": "R6201"
    },
    {
        "type": "refactor",
        "module": "myproj.widgets",
        "obj": "_CollapsibleMixin.set_inst_attrs",
        "line": 185,
        "column": 30,
        "endLine": 185,
        "endColumn": 44,
        "path": "myproj\\widgets.py",
        "symbol": "use-set-for-membership",
        "message": "Consider using set for membership test",
        "message-id": "R6201"
    },
    {
        "type": "refactor",
        "module": "myproj.widgets",
        "obj": "_CollapsibleMixin.container_size_limits",
        "line": 270,
        "column": 12,
        "endLine": 273,
        "endColumn": 64,
        "path": "myproj\\widgets.py",
        "symbol": "else-if-used",
        "message": "Consider using \"elif\" instead of \"else\" then \"if\" to remove one indentation level",
        "message-id": "R5501"
    },
    {
        "type": "refactor",
        "module": "myproj.widgets",
        "obj": "_CollapsibleMixin.container_size_limits",
        "line": 270,
        "column": 39,
        "endLine": 270,
        "endColumn": 53,
        "path": "myproj\\widgets.py",
        "symbol": "use-set-for-membership",
        "message": "Consider using set for membership test",
        "message-id": "R6201"
    },
    {
        "type": "refactor",
        "module": "myproj.widgets",
        "obj": "CollapsibleTabWidget.content_size",
        "line": 406,
        "column": 35,
        "endLine": 406,
        "endColumn": 49,
        "path": "myproj\\widgets.py",
        "symbol": "use-set-for-membership",
        "message": "Consider using set for membership test",
        "message-id": "R6201"
    },
    {
        "type": "refactor",
        "module": "myproj.widgets",
        "obj": "CollapsibleContainer.content_size",
        "line": 579,
        "column": 43,
        "endLine": 579,
        "endColumn": 57,
        "path": "myproj\\widgets.py",
        "symbol": "use-set-for-membership",
        "message": "Consider using set for membership test",
        "message-id": "R6201"
    }
]

Extension version: 2022.8.1 VS Code version: Code 1.68.1 (30d9c6cd9483b2cc586687151bcbcd635f373630, 2022-06-14T12:48:58.283Z) OS version: Windows_NT x64 10.0.19042 Restricted Mode: No

System Info
Item Value
CPUs Intel® Xeon® Gold 6248R CPU @ 3.00GHz (48 x 2993)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 190.65GB (150.33GB free)
Process Argv –crash-reporter-id 9e9db912-c31c-4be1-8c40-4080829b5095
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
vscscmwlcmt:30465135
cppdebug:30492333
vsclangdc:30486549

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
karthiknadigcommented, Jul 7, 2022

@adam-grant-hendry those are all refactor types, this means that these will be marked as hints. These won’t show red/yellow squiggles. If you want you can change their severity by setting this:

"pylint.severity": {
    "convention": "Information",
    "error": "Error",
    "fatal": "Error",
    "refactor": "Warning", // <--- By default this is Hint.
    "warning": "Warning",
    "info": "Information"
}
0reactions
adam-grant-hendrycommented, Jul 7, 2022

@karthiknadig Thank you, that was the issue. For reference (future readers), with the python.linting.pylint extension, the same arguments are:

  // Severity of Pylint message type 'Convention/C'.
  "python.linting.pylintCategorySeverity.convention": "Information",

  // Severity of Pylint message type 'Error/E'.
  "python.linting.pylintCategorySeverity.error": "Error",

  // Severity of Pylint message type 'Fatal/F'.
  "python.linting.pylintCategorySeverity.fatal": "Error",

  // Severity of Pylint message type 'Refactor/R'.
  "python.linting.pylintCategorySeverity.refactor": "Hint",  // <--- By default this is Hint.

  // Severity of Pylint message type 'Warning/W'.
  "python.linting.pylintCategorySeverity.warning": "Warning",
Read more comments on GitHub >

github_iconTop Results From Across the Web

Optional pylint Plugins not Linting in VSCode #3003 - GitHub
Pylint is a separate linting tool. It's not related to pylance. So this isn't the right place to report issues with pylint.
Read more >
Linting Python in Visual Studio Code
The linter has not been installed in the current Python environment. Open a command prompt, navigate to the location where your selecter interpreter...
Read more >
Pylint not running as expected in VScode - Stack Overflow
Simply enter "python.linting.pylintUseMinimalCheckers": false, into your .vscode/settings.json to force this off. This is how mine looks:
Read more >
Linting & Formatting - How to Python in VS Code documentation
Setting Up Linters in VS Code¶ · Press ctrl+, to fire up the settings panel · Search for flake8 in the search panel...
Read more >
Linting | Python in Visual Studio Code
By default linting is enabled and uses pylint. If you wish to turn this off, you could do so either in the User...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found