I'm trying to create a custom SonarQube rule in VisualStudio 2015, using the Roslyn SDK Generator.
The generator works fine and I'm able to publish the .jar file to SonarQube server and use my custom rule in daily builds. Now I would like to categorize the rule as "Vulnerabilty", but it always appear as "Code Smell".
I tried a couple of approaches:
Changed the "Category" of the DiagnosticDescriptor class to "Security"
private const string Category = "Security"; private static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true, description: Description); public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } }
Changed the xml template provided by the generator and regenerated the plugin using the new xml (I tried "SECURITY" and "SECURITY_COMPLIANCE" in place of the generated "MAINTENABILITY_COMPLIANCE")
<sqale xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <chc> <key>SECURITY</key> <chc> <rule-key>MyRule</rule-key> <prop> <key>remediationFunction</key> <txt>CONSTANT_ISSUE</txt> </prop> <prop> <key>offset</key> <txt /> <val>15min</val> </prop> </chc> </chc> </sqale>
Nothing worked so far.
I'm using the following configuration:
- VS2015 Update 3
- SonarQube v. 6.1
- SonarLint v. 2.8
- Custom C# analyzer developed with SonarQube.Roslyn.SDK v. 1.0