3 Commits

Author SHA1 Message Date
FrigaT
3c4eda7f57 Доработан js2
All checks were successful
CI / build-test (push) Successful in 40s
Release / pack-and-publish (release) Successful in 47s
2025-12-28 23:26:51 +03:00
FrigaT
119d94b0e8 изменен стиль v2 html 2025-12-28 23:25:51 +03:00
FrigaT
bf6c0b9229 Доработан js 2025-12-28 20:10:37 +03:00
5 changed files with 1697 additions and 2766 deletions

View File

@@ -44,7 +44,7 @@ namespace SQLLinter.CLI
["UpperLower"] = Common.RuleViolationSeverity.Critical, ["UpperLower"] = Common.RuleViolationSeverity.Critical,
["SetVariable"] = Common.RuleViolationSeverity.Critical, ["SetVariable"] = Common.RuleViolationSeverity.Critical,
}, },
GenerateDetails = false, GenerateDetails = true,
}; };
//var linter = new Linter(con, rep); //var linter = new Linter(con, rep);
@@ -62,30 +62,30 @@ namespace SQLLinter.CLI
Dictionary<string, Stream> files = new(); Dictionary<string, Stream> files = new();
for (int i = 0; i < 2; i++) for (int i = 0; i < 15; i++)
{ {
files[name + i + ".sql"] = reader.BaseStream; files[name + i + ".sql"] = reader.BaseStream;
} }
linter.Run(files); linter.Run(files);
//diagramer.Run("test.sql", reader.BaseStream); diagramer.Run("test.sql", reader.BaseStream);
} }
//linter.Run(@"C:\Users\frost\Desktop\DISTR-2599\test.sql"); //linter.Run(@"C:\Users\frost\Desktop\DISTR-2599\test.sql");
IReportFormatter formatter = new F.v3.HtmlReportFormatter(); IReportFormatter formatter = new F.v3.HtmlReportFormatter();
var content = formatter.Format(rep.Violations, null); var content = formatter.Format(rep.Violations, bpmn);
File.WriteAllText(@"C:\Users\frost\Downloads\Telegram Desktop\test3.html", content); File.WriteAllText(@"C:\Users\frost\Downloads\Telegram Desktop\test3.html", content);
formatter = new F.v2.HtmlReportFormatter(); formatter = new F.v2.HtmlReportFormatter();
content = formatter.Format(rep.Violations, null); content = formatter.Format(rep.Violations, bpmn);
File.WriteAllText(@"C:\Users\frost\Downloads\Telegram Desktop\test2.html", content); File.WriteAllText(@"C:\Users\frost\Downloads\Telegram Desktop\test2.html", content);
formatter = new F.v1.HtmlReportFormatter(); formatter = new F.v1.HtmlReportFormatter();
content = formatter.Format(rep.Violations, null); content = formatter.Format(rep.Violations, bpmn);
File.WriteAllText(@"C:\Users\frost\Downloads\Telegram Desktop\test1.html", content); File.WriteAllText(@"C:\Users\frost\Downloads\Telegram Desktop\test1.html", content);
} }
} }

View File

@@ -104,6 +104,14 @@ public abstract class BaseRuleVisitor : TSqlFragmentVisitor, IRule
case SchemaObjectFunctionTableReference: case SchemaObjectFunctionTableReference:
return current; return current;
// DML
case InsertStatement:
case UpdateStatement:
case DeleteStatement:
case MergeStatement:
return current;
// ---- Новые блоки для SqlDataTypeReference ---- // ---- Новые блоки для SqlDataTypeReference ----
// Определение столбца // Определение столбца
@@ -160,10 +168,12 @@ public abstract class BaseRuleVisitor : TSqlFragmentVisitor, IRule
if (node == null || node.ScriptTokenStream == null) if (node == null || node.ScriptTokenStream == null)
return null; return null;
var endLine = node.ScriptTokenStream.Where(t => t.Offset < node.StartOffset + node.FragmentLength).Max(t => t.Line) + 2;
// 1. Получаем токены для блока // 1. Получаем токены для блока
var tokens = node.ScriptTokenStream var tokens = node.ScriptTokenStream
.Where(t => t.Line >= node.StartLine && .Where(t => t.Line >= node.StartLine - 2 &&
t.Offset < node.StartOffset + node.FragmentLength) t.Line <= endLine)
.ToList(); .ToList();
if (tokens.Count == 0) if (tokens.Count == 0)

View File

@@ -225,7 +225,7 @@ public class HtmlReportFormatter : IReportFormatter
var lineClass = "code-line"; var lineClass = "code-line";
if (isErrorLine) if (isErrorLine)
{ {
lineClass += " error-line"; lineClass += $" {errorSeverity}-line";
} }
sb.Append($"<div class=\"{lineClass}\">"); sb.Append($"<div class=\"{lineClass}\">");