Пример #1
0
        public static DiagnosticIds FromDiagnosticId(string ruleId)
        {
            var           id            = ruleId.Replace("SCQC", string.Empty);
            DiagnosticIds diagnosticIds = (DiagnosticIds)Enum.Parse(typeof(DiagnosticIds), id, true);

            return(diagnosticIds);
        }
 public static DiagnosticResult[] CreateArray(DiagnosticIds diagnosticId, Regex message = null)
 {
     return(new DiagnosticResult[]
     {
         Create(diagnosticId, message),
     });
 }
 public static DiagnosticResult Create(DiagnosticIds diagnosticId, Regex message = null)
 {
     return(new DiagnosticResult()
     {
         Id = Helper.ToDiagnosticId(diagnosticId),
         Location = new DiagnosticResultLocation(null),
         Message = message ?? new Regex(".*"),
         Severity = DiagnosticSeverity.Error,
     });
 }
Пример #4
0
 public AttributeModel(string name, string fullName, string title, string messageFormat, string description, DiagnosticIds diagnosticId, bool canBeSuppressed, bool isEnabledByDefault)
 {
     Name            = name;
     FullName        = fullName;
     Title           = title;
     MessageFormat   = messageFormat;
     Description     = description;
     DiagnosticId    = diagnosticId;
     Rule            = CreateRule(isEnabledByDefault);
     CanBeSuppressed = canBeSuppressed;
 }
Пример #5
0
 internal BaseDesignAnalyzer(DiagnosticIds diagnosticId)
 {
     DiagnosticId = diagnosticId;
     Rule         = new DiagnosticDescriptor(Helper.ToDiagnosticId(diagnosticId),
                                             Title,
                                             MessageFormat,
                                             nameof(Categories.Design),
                                             DiagnosticSeverity.Warning,
                                             isEnabledByDefault: true,
                                             description: Description);
 }
Пример #6
0
 private DiagnosticResult GetExpectedDiagnostic(DiagnosticIds id)
 {
     return(new DiagnosticResult
     {
         Id = Helper.ToDiagnosticId(id),
         Message = new Regex(".*"),
         Severity = DiagnosticSeverity.Error,
         Locations = new[]
         {
             new DiagnosticResultLocation("Test0.cs", 6, 16)
         }
     });
 }
        internal HelixLayerAnalyzer(DiagnosticIds diagnosticId, string baseNamespace, string parentNamespace)
        {
            DiagnosticId = diagnosticId;
            Rule         = new DiagnosticDescriptor(Helper.ToDiagnosticId(diagnosticId),
                                                    Title,
                                                    MessageFormat,
                                                    nameof(Categories.Design),
                                                    DiagnosticSeverity.Warning,
                                                    isEnabledByDefault: true,
                                                    description: Description);

            BaseNamespace   = baseNamespace;
            ParentNamespace = parentNamespace;
        }
Пример #8
0
 public AttributeModel(AttributeDefinition attribute, string title, string messageFormat, string description, DiagnosticIds diagnosticId, bool canBeSuppressed, bool isEnabledByDefault)
     : this(attribute.Name, attribute.FullName, title, messageFormat, description, diagnosticId, canBeSuppressed, isEnabledByDefault)
 {
 }
Пример #9
0
 public static string ToDiagnosticId(DiagnosticIds id)
 {
     return(@"PH" + ((int)id).ToString());
 }
Пример #10
0
 public static string ToDiagnosticId(DiagnosticIds id)
 {
     return($"SCQC" + ((int)id).ToString("0000"));
 }