Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19c2357c04 | ||
|
|
3c4eda7f57 | ||
|
|
119d94b0e8 | ||
|
|
bf6c0b9229 |
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -143,6 +143,6 @@ public class HtmlReportFormatter : IReportFormatter
|
|||||||
sb.AppendLine("</body>");
|
sb.AppendLine("</body>");
|
||||||
sb.AppendLine("</html>");
|
sb.AppendLine("</html>");
|
||||||
|
|
||||||
return HtmlMinifier.MinifyHtml(sb.ToString());
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -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}\">");
|
||||||
|
|||||||
Reference in New Issue
Block a user