Добавлены mermaid диаграммы
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
using SQLLinter.Common;
|
||||
using SQLLinter.Infrastructure.Diagram;
|
||||
using System.Text;
|
||||
|
||||
namespace SQLLinter.Infrastructure.Reporters;
|
||||
|
||||
public class MarkdownReportFormatter : IReportFormatter
|
||||
{
|
||||
public string Format(List<IRuleViolation> violations)
|
||||
{
|
||||
if (violations.Count == 0)
|
||||
{
|
||||
return "_Нет нарушений_";
|
||||
}
|
||||
|
||||
// Группировка по файлу
|
||||
var groupedByFile = violations
|
||||
.GroupBy(v => v.FileName)
|
||||
.OrderBy(g => g.Key); // сортировка файлов по имени
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
foreach (var fileGroup in groupedByFile)
|
||||
{
|
||||
sb.AppendLine($"## Файл: {fileGroup.Key}");
|
||||
sb.AppendLine();
|
||||
|
||||
// Группировка по severity внутри файла
|
||||
var groupedBySeverity = fileGroup
|
||||
.GroupBy(v => v.Severity)
|
||||
.OrderByDescending(g => g.Key); // сначала Error, потом Warning, потом Info
|
||||
|
||||
foreach (var severityGroup in groupedBySeverity)
|
||||
{
|
||||
sb.AppendLine($"### {severityGroup.Key}");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("| Строка | Колонка | Правило | Описание |");
|
||||
sb.AppendLine("|--------|---------|---------|----------|");
|
||||
|
||||
foreach (var v in severityGroup
|
||||
.OrderBy(x => x.Line)
|
||||
.ThenBy(x => x.Column))
|
||||
{
|
||||
sb.AppendLine($"| {v.Line} | {v.Column} | {v.RuleName} | {v.Text} |");
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
|
||||
}
|
||||
|
||||
public string Format(List<IRuleViolation> violations, BpmnDiagram diagram)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user