SonarQube.Plugins.Roslyn.RuleGenerator.GetDescriptionAsRawHtml C# (CSharp) Method

GetDescriptionAsRawHtml() private static method

Returns the description as HTML
private static GetDescriptionAsRawHtml ( Microsoft.CodeAnalysis.DiagnosticDescriptor diagnostic ) : string
diagnostic Microsoft.CodeAnalysis.DiagnosticDescriptor
return string
        private static string GetDescriptionAsRawHtml(DiagnosticDescriptor diagnostic)
        {
            StringBuilder sb = new StringBuilder();
            bool hasDescription = false;

            string details = diagnostic.Description.ToString(CultureInfo.CurrentCulture);
            if (!String.IsNullOrWhiteSpace(details))
            {
                sb.AppendLine("<p>" + details + "</p>");
                hasDescription = true;
            }

            if (!String.IsNullOrWhiteSpace(diagnostic.HelpLinkUri))
            {
                sb.AppendLine("<h2>" + UIResources.RuleGen_MoreDetailsTitle + "</h2>");
                sb.AppendLine(String.Format(UIResources.RuleGen_ForMoreDetailsLink, diagnostic.HelpLinkUri));
                hasDescription = true;
            }

            if (!hasDescription)
            {
                return UIResources.RuleGen_NoDescription;
            }

            return sb.ToString();
        }