简体   繁体   English

如何在 VSCode 中重置或更改 SonarLint 的规则?

[英]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.在 VSCode 中使用 SonarLint,我禁用了某些规则以运行本地 java 程序。 However when checked in to the GIT project, the CI build failed.但是,当签入 GIT 项目时,CI 构建失败。 How can I turn the SonarLint rules back on so I can get the benefit of the linting again?如何重新打开 SonarLint 规则,以便再次从 linting 中受益?

Open View > Command Palette... (Mac: Cmd+Shift+P)打开视图 > 命令面板...(Mac:Cmd+Shift+P)

Select Preferences: Open Settings (JSON) Select Preferences: Open Settings (JSON)

In the settings.json file, the disabled SonarLint rules are listed:在 settings.json 文件中,列出了禁用的 SonarLint 规则:

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

Delete the rules you wish to reactivate, save the settings删除要重新激活的规则,保存设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM