Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to Completely Disable Yellow Warning Lines in VS Code for Python?


Question:

I’m working on a Python project in Visual Studio Code, and I’m getting persistent yellow warning lines in my code. I want to completely disable these, but so far, I’ve had no luck. Here’s what I’ve tried:
enter image description here

  1. Disabling Pylint and Other Linters: I’ve attempted to disable all Python linting by adding the following to my settings.json file:

    MEDevel.com: Open-source for Healthcare and Education

    Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

    Visit Medevel

    "python.linting.enabled": false
    
  2. Changing the Type Checking Mode: I’ve modified the Python analysis settings in my settings.json file as follows:

    "python.analysis.typeCheckingMode": "basic"
    "python.analysis.typeCheckingMode": "off"
    
  3. Customizing Editor Warnings and Errors: I’ve tried to change the color of the error and warning lines with the following settings in my settings.json file:

    "editorError.foreground": "#00000000",
    "editorWarning.foreground": "#00000000",
    "editorInfo.foreground": "#00000000"
    
  4. Restarting VS Code: I’ve fully closed and reopened VS Code after making these changes.

  5. Checking Workspace and Project-Specific Settings: I’ve checked for workspace or project-specific settings that might be overriding my global settings.

Despite these attempts, the yellow warning lines have not disappeared. They changed from red to yellow, but I would like to remove them entirely. How can I achieve this?


>Solution :

I’m not looking to resolve the errors but merely to study the code without the distraction of these warnings.

I understand that warnings generally indicate potential issues in the code, but in this specific case, I’m working with a segment of code for learning purposes, and the warnings were more of a distraction.

For this there is the following method

Violent solution:

    "python.analysis.diagnosticSeverityOverrides": {
        "reportUndefinedVariable": "none"
    },

But warnings generally indicate that your code may be incorrect, and the most correct way should be to modify your code to be correct and compliant.

More configurable values for this setting can be found in Diagnostic severity rules in this link.

https://code.visualstudio.com/docs/python/settings-reference#_python-language-server-settings

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading