Изменено формирование ошибок на темплейты
This commit is contained in:
@@ -7,15 +7,22 @@ namespace SQLLinter.Infrastructure.Reporters;
|
||||
public class Reporter : IReporter
|
||||
{
|
||||
private readonly List<string> _log = new();
|
||||
private readonly bool _useLogging;
|
||||
|
||||
public int? FixedCount { get; set; }
|
||||
|
||||
private readonly ConcurrentBag<IRuleViolation> ruleViolations = new();
|
||||
|
||||
public List<IRuleViolation> Violations => ruleViolations.ToList();
|
||||
|
||||
public Reporter(bool useLogging = false)
|
||||
{
|
||||
_useLogging = useLogging;
|
||||
}
|
||||
|
||||
public virtual void Report(string message)
|
||||
{
|
||||
_log.Add(message);
|
||||
if (_useLogging) _log.Add(message);
|
||||
}
|
||||
|
||||
public List<string> GetLog() => _log;
|
||||
@@ -34,8 +41,17 @@ public class Reporter : IReporter
|
||||
Report(violation.ToString());
|
||||
}
|
||||
|
||||
public void ReportViolation(string fileName, int line, int column, RuleViolationSeverity severity, string ruleName, string violationText)
|
||||
public void ReportViolation(string fileName, int line, int column, RuleViolationSeverity severity, string ruleName, string template, params string[] param)
|
||||
{
|
||||
ReportViolation(new RuleViolation(fileName, ruleName, violationText, line, column, severity));
|
||||
ReportViolation(new RuleTemplateViolation()
|
||||
{
|
||||
FileName = fileName,
|
||||
RuleName = ruleName,
|
||||
RuleTemplate = template,
|
||||
Line = line,
|
||||
Column = column,
|
||||
Severity = severity,
|
||||
Params = param.ToList(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user