\r\n".Length ? "Code" : string.Empty)}")
- .AppendLine($" {analyzer.GetType().Name} | ")
+ .AppendLine($" {analyzer.GetType().Name} | ")
.AppendLine("
");
}
@@ -249,36 +260,17 @@ private DescriptorInfo(DiagnosticAnalyzer analyzer, DiagnosticDescriptor descrip
{
this.Analyzer = analyzer;
this.Descriptor = descriptor;
- this.DocFileName = Path.Combine(DocumentsDirectory.FullName, descriptor.Id + ".md");
- this.CodeFileName = Directory.EnumerateFiles(
- SolutionDirectory.FullName,
- analyzer.GetType().Name + ".cs",
- SearchOption.AllDirectories)
- .FirstOrDefault();
- this.CodeFileUri = GetCodeFileUri(analyzer);
+ this.DocumentationFile = new MarkdownFile(Path.Combine(DocumentsDirectory.FullName, descriptor.Id + ".md"));
+ this.AnalyzerFile = CodeFile.Find(analyzer.GetType());
}
public DiagnosticAnalyzer Analyzer { get; }
- public bool DocExists => File.Exists(this.DocFileName);
-
public DiagnosticDescriptor Descriptor { get; }
- public string DocFileName { get; }
-
- public string CodeFileName { get; }
+ public MarkdownFile DocumentationFile { get; }
- public string CodeFileUri { get; }
-
- public static string GetCodeFileUri(DiagnosticAnalyzer analyzer)
- {
- var fileName = Directory.EnumerateFiles(SolutionDirectory.FullName, analyzer.GetType().Name + ".cs", SearchOption.AllDirectories)
- .FirstOrDefault();
- return fileName != null
- ? "https://github.com/DotNetAnalyzers/AspNetCoreAnalyzers/blob/master" +
- fileName.Substring(SolutionDirectory.FullName.Length).Replace("\\", "/", StringComparison.Ordinal)
- : "missing";
- }
+ public CodeFile AnalyzerFile { get; }
public static IEnumerable