Добавлена настройка генерации деталировки
This commit is contained in:
@@ -8,5 +8,6 @@ namespace SQLLinter.Infrastructure.Configuration
|
||||
public int CompatibilityLevel { get; set; }
|
||||
public Dictionary<string, RuleViolationSeverity> Rules { get; set; } = new();
|
||||
public List<string> Plugins { get; set; } = new();
|
||||
public bool GenerateDetails { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,16 @@ namespace SQLLinter.Infrastructure.Parser;
|
||||
public class SqlFileProcessor : ISqlFileProcessor
|
||||
{
|
||||
private readonly IRuleVisitor ruleVisitor;
|
||||
private readonly IConfig _config;
|
||||
|
||||
private readonly IRuleExceptionFinder ruleExceptionFinder;
|
||||
|
||||
public SqlFileProcessor(
|
||||
public SqlFileProcessor(IConfig config,
|
||||
IRuleVisitor ruleVisitor,
|
||||
IPluginHandler pluginHandler
|
||||
)
|
||||
{
|
||||
this._config = config;
|
||||
this.ruleVisitor = ruleVisitor;
|
||||
ruleExceptionFinder = new RuleExceptionFinder(pluginHandler.RuleWithNames);
|
||||
}
|
||||
@@ -93,7 +95,7 @@ public class SqlFileProcessor : ISqlFileProcessor
|
||||
|
||||
private void ProcessRules(Stream fileStream, IEnumerable<IRuleException> ignoredRules, string filePath)
|
||||
{
|
||||
ruleVisitor.VisitRules(filePath, ignoredRules, fileStream);
|
||||
ruleVisitor.VisitRules(filePath, ignoredRules, fileStream, this._config.GenerateDetails);
|
||||
}
|
||||
|
||||
private Stream GetFileContents(string filePath)
|
||||
|
||||
@@ -30,7 +30,7 @@ public class SqlRuleVisitor : IRuleVisitor
|
||||
this._sqlStreamReaderBuilder = sqlStreamReaderBuilder;
|
||||
}
|
||||
|
||||
public void VisitRules(string sqlPath, IEnumerable<IRuleException> ignoredRules, Stream sqlFileStream)
|
||||
public void VisitRules(string sqlPath, IEnumerable<IRuleException> ignoredRules, Stream sqlFileStream, bool generateDetails)
|
||||
{
|
||||
var overrides = _overrideFinder.GetOverrideList(sqlFileStream);
|
||||
var overrideArray = overrides as IOverride[] ?? overrides.ToArray();
|
||||
@@ -39,7 +39,7 @@ public class SqlRuleVisitor : IRuleVisitor
|
||||
|
||||
if (sqlFragment == null) return;
|
||||
|
||||
var parentMap = ParentMapBuilder.Build(sqlFragment);
|
||||
Dictionary<TSqlFragment, TSqlFragment?>? parentMap = generateDetails ? ParentMapBuilder.Build(sqlFragment) : null;
|
||||
|
||||
var ruleExceptions = ignoredRules as IRuleException[] ?? ignoredRules.ToArray();
|
||||
if (errors.Any())
|
||||
|
||||
@@ -339,11 +339,7 @@ class ReportRenderer {
|
||||
${details ? `
|
||||
<tr class="violation-detail-row" id="${detailId}" style="display: none;">
|
||||
<td colspan="5" class="detail-cell">
|
||||
<div class="code-block">
|
||||
<div class="code-container">
|
||||
${details} <!-- HTML вставляется как есть, предполагается доверенный источник -->
|
||||
</div>
|
||||
</div>
|
||||
${details} <!-- HTML вставляется как есть, предполагается доверенный источник -->
|
||||
</td>
|
||||
</tr>
|
||||
` : ''}
|
||||
|
||||
Reference in New Issue
Block a user