/// <summary>
 /// Creates a new DiagnosticDescriptor instance copying all the properties from the original, overriding the
 /// Severity.
 /// </summary>
 /// <param name="descriptor">DiagnosticDescriptor instance to copy.</param>
 /// <param name="severity">The new value of the Severity property.</param>
 /// <returns>A new DiagnosticDescriptor instance with overridden value of the Severity property.</returns>
 public static DiagnosticDescriptor WithSeverity(this DiagnosticDescriptor descriptor, Severity severity)
 {
     return(new DiagnosticDescriptor(
                descriptor.Id,
                (string)descriptor.Title,
                (string)descriptor.MessageFormat,
                descriptor.Category,
                severity.ToDiagnosticSeverity(),
                descriptor.IsEnabledByDefault,
                (string)descriptor.Description,
                descriptor.HelpLinkUri,
                descriptor.CustomTags.ToArray()));
 }
Beispiel #2
0
 public static DiagnosticSeverity ToDiagnosticSeverity(this Severity severity)
 {
     return(severity.ToDiagnosticSeverity(IdeVisibility.Visible));
 }
 public static DiagnosticDescriptor CreateDiagnosticDescriptor(string diagnosticId, string messageFormat)
 {
     return(new DiagnosticDescriptor(diagnosticId, Description, messageFormat, Category,
                                     RuleSeverity.ToDiagnosticSeverity(), IsActivatedByDefault,
                                     helpLinkUri: "http://nemo.sonarqube.org/coding_rules#rule_key=csharpsquid%3ACommentRegularExpression"));
 }
Beispiel #4
0
 public static DiagnosticDescriptor CreateDiagnosticDescriptor(string diagnosticId, string messageFormat)
 {
     return(new DiagnosticDescriptor(diagnosticId, Title, messageFormat, Category,
                                     RuleSeverity.ToDiagnosticSeverity(), IsActivatedByDefault));
 }