Search code examples
javavisual-studio-codesonarlint

How can I reset or change rules for SonarLint in VSCode?


Using SonarLint in VSCode, I disabled certain rules to get a local java program to run. However when checked in to the GIT project, the CI build failed. How can I turn the SonarLint rules back on so I can get the benefit of the linting again?


Solution

  • Open View > Command Palette... (Mac: Cmd+Shift+P)

    Select Preferences: Open Settings (JSON)

    In the settings.json file, the disabled SonarLint rules are listed:

    "sonarlint.rules": {
        "java:S2095": {
            "level": "off"
        },
        "java:S1192": {
            "level": "off"
        }
    }
    

    Delete the rules you wish to reactivate, save the settings