SonarQube排除csharpsquid:S3990规则失效,求助解决方法
I’ve encountered similar quirks with older SonarQube and C# plugin combinations, so let’s walk through the most likely fixes for your scenario:
Double-check rule key and exclusion scope
First, confirm you’re using the exact rule key as displayed in your SonarQube instance’s rule details. Whilecsharpsquid:S3990is correct for the "Properties should not be used as parameters" rule, typos or mismatched keys can silently break exclusions. Also, ensure you’re applying the exclusion at the right level: either uncheck the rule in your project’s quality profile, or add it to the project’s Settings > Exclusions > Rule Exclusions with the path pattern—don’t mix server-level and project-level settings accidentally.Validate your file path pattern
The**/*.*pattern should theoretically match all files, but SonarQube 6.7.1 has minor quirks with recursive path matching. Try testing with a more specific path first (e.g.,MySpecificProject/**/*.*if violations are isolated to one project) to rule out path-related issues. Also, confirm the paths are relative to the project root defined in your VSTS SonarQube task.Check for conflicting configurations
It’s easy for another setting to override your rule exclusion:- If your quality profile marks
csharpsquid:S3990as "Mandatory", project-level exclusions won’t apply. Double-check the quality profile’s rule status. - Look at the "Additional Properties" field in your VSTS task—any global exclusions or conflicting rule flags here could take precedence over your project setup.
- If your quality profile marks
Test plugin version compatibility
SonarQube 6.7.1 is an older release, and the C# plugin 7.0.1 might have known bugs with rule exclusions. Check for the latest compatible C# plugin version for SonarQube 6.7.1 (the latest supported is around 7.1.x) and upgrade it—minor plugin updates often patch these kinds of exclusion glitches.Dig into verbose analysis logs
Enable verbose logging in your VSTS SonarQube task (toggle the "Verbose" option or add/v:detailedto MSBuild arguments) and search forcsharpsquid:S3990in the logs. You’ll see messages about whether the rule was successfully excluded, or errors about invalid path patterns. This is often the fastest way to pinpoint exactly where the exclusion is failing.
内容的提问来源于stack exchange,提问作者sandeep manthri

