Ejemplo n.º 1
0
 public static string ProcessAnalyzerTemplateText(string template, 
                                                  AnalyzerDetails details,
                                                  ImplementationStatus status,
                                                  ExtraWordsContents extraWords,
                                                  string headerTemplate,
                                                  Func<string, string> linkCreator)
 {
     return template.Replace("%HEADER%", ProcessHeaderTemplate(headerTemplate, details.NameWithCode))
                    .Replace("%NAME%", details.Name)
                    .Replace("%NAME-AND-CODE%", details.NameWithCode)
                    .Replace("%STATUS%", status == Implemented ? "Implemented" : "Planned for a future release")
                    .Replace("%CODE%", details.Title.ToString())
                    .Replace("%ID%", details.DiagnosticId)
                    .Replace("%DESCRIPTION%", details.Description.ToString())
                    .Replace("%CATEGORY%", details.Category.Name)
                    .Replace("%CATEGORY-LINK%", $"{linkCreator(CategoryNameLink(details.Category))}")
                    .Replace("%SEVERITY%", details.SeverityText)
                    .Replace("%ENABLED-BY_DEFAULT%", details.EnabledByDefault ? "Yes" : "No")
                    .Replace("%CAUSE-WORDS%", extraWords.Cause)
                    .Replace("%PRE-CODEFIX-WORDS%", extraWords.PreCodeFix)
                    .Replace("%POST-CODEFIX-WORDS%", extraWords.PostCodeFix)
                    .Replace("%PRE-SUPPRESSION-WORDS%", extraWords.PreSuppression)
                    .Replace("%POST-SUPPRESSION-WORDS%", extraWords.PostSuppression)
                    .Replace("%CODEFIXES%", GenerateCodeFixMessage(status))
                    .Replace("%SUPPRESSIONS%", GenerateSuppressionMessage(details.SuppressionAttributes, status));
 }
 public NamedItemSuppresionAttributeDetails(string className,
                                            AnalyzerCategoryDetails category,
                                            DefaultState defaultState,
                                            DiagnosticSeverity severity,
                                            string titleResourceName,
                                            string descriptionResourceName,
                                            string messageFormatResourceName)
 {
     _analyzerDetails = new AnalyzerDetails(className,
                                            category,
                                            defaultState,
                                            severity,
                                            titleResourceName,
                                            descriptionResourceName,
                                            messageFormatResourceName,
                                            new List <Type>());
 }
 public NamedItemSuppresionAttributeDetails(string className, 
                        AnalyzerCategoryDetails category,
                        DefaultState defaultState,
                        DiagnosticSeverity severity,
                        string titleResourceName,
                        string descriptionResourceName,
                        string messageFormatResourceName)
 {
     _analyzerDetails = new AnalyzerDetails(className,
                                            category,
                                            defaultState,
                                            severity,
                                            titleResourceName,
                                            descriptionResourceName,
                                            messageFormatResourceName,
                                            new List<Type>());
 }
Ejemplo n.º 4
0
 private static string CreateAnalyzerLink(AnalyzerDetails analyzer, Func<string, string> linkCreator) =>
     $"* [{analyzer.NameWithCode}]({linkCreator(analyzer.DiagnosticId)}){NewLine}";