Изменено формирование ошибок на темплейты
This commit is contained in:
@@ -4,46 +4,25 @@ namespace SQLLinter.Infrastructure.Rules.RuleViolations
|
||||
{
|
||||
public class RuleViolation : IRuleViolation
|
||||
{
|
||||
public RuleViolation(string fileName, string ruleName, string text, int startLine, int startColumn, RuleViolationSeverity severity)
|
||||
{
|
||||
FileName = fileName;
|
||||
RuleName = ruleName;
|
||||
Text = text;
|
||||
Line = startLine;
|
||||
Column = startColumn;
|
||||
Severity = severity;
|
||||
}
|
||||
required public string FileName { get; init; }
|
||||
|
||||
public RuleViolation(string fileName, string ruleName, int startLine, int startColumn)
|
||||
{
|
||||
FileName = fileName;
|
||||
RuleName = ruleName;
|
||||
Line = startLine;
|
||||
Column = startColumn;
|
||||
}
|
||||
required public int Column { get; set; }
|
||||
|
||||
public RuleViolation(string ruleName, int startLine, int startColumn)
|
||||
{
|
||||
RuleName = ruleName;
|
||||
Line = startLine;
|
||||
Column = startColumn;
|
||||
}
|
||||
required public int Line { get; set; }
|
||||
|
||||
public int Column { get; set; }
|
||||
required public string RuleName { get; init; }
|
||||
|
||||
public string FileName { get; set; }
|
||||
required public RuleViolationSeverity Severity { get; init; }
|
||||
|
||||
public int Line { get; set; }
|
||||
virtual public string Text { get; set; }
|
||||
}
|
||||
|
||||
public string RuleName { get; set; }
|
||||
public class RuleTemplateViolation : RuleViolation
|
||||
{
|
||||
override public string Text => string.Format(RuleTemplate, Params.ToArray());
|
||||
|
||||
public RuleViolationSeverity Severity { get; set; }
|
||||
required public string RuleTemplate { get; init; }
|
||||
|
||||
public string Text { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $@"{Severity.ToString().ToUpper()}: L{Line} C{Column} {FileName} ""{Text}""";
|
||||
}
|
||||
public List<string> Params { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user