using SQLLinter.Infrastructure.Configuration; using SQLLinter.Infrastructure.Diagram; using SQLLinter.Infrastructure.Parser; using SQLLinter.Infrastructure.Reporters; using F = SQLLinter.Infrastructure.Reporters.Formatters.Html; namespace SQLLinter.CLI { internal class Program { static void Main(string[] args) { var rep = new Reporter(); var con = new Config() { CompatibilityLevel = 170, Plugins = [], Rules = new() { ["CaseSensitiveVariables"] = Common.RuleViolationSeverity.Critical, ["ConditionalBeginEnd"] = Common.RuleViolationSeverity.Critical, ["CountStar"] = Common.RuleViolationSeverity.Critical, ["CrossDatabaseTransaction"] = Common.RuleViolationSeverity.Critical, ["DataCompression"] = Common.RuleViolationSeverity.Critical, ["DataTypeLength"] = Common.RuleViolationSeverity.Critical, ["DeleteWhere"] = Common.RuleViolationSeverity.Critical, ["DisallowCursors"] = Common.RuleViolationSeverity.Critical, ["DuplicateEmptyLine"] = Common.RuleViolationSeverity.Off, ["DuplicateGo"] = Common.RuleViolationSeverity.Critical, ["FullText"] = Common.RuleViolationSeverity.Critical, ["InformationSchema"] = Common.RuleViolationSeverity.Critical, ["KeywordCapitalization"] = Common.RuleViolationSeverity.Critical, ["LinkedServer"] = Common.RuleViolationSeverity.Critical, ["MultiTableAlias"] = Common.RuleViolationSeverity.Critical, ["NamedConstraint"] = Common.RuleViolationSeverity.Critical, ["NonSargable"] = Common.RuleViolationSeverity.Critical, ["ObjectProperty"] = Common.RuleViolationSeverity.Critical, ["PrintStatement"] = Common.RuleViolationSeverity.Critical, ["SchemaQualify"] = Common.RuleViolationSeverity.Critical, ["SelectStar"] = Common.RuleViolationSeverity.Critical, ["SemicolonTermination"] = Common.RuleViolationSeverity.Off, ["UnicodeString"] = Common.RuleViolationSeverity.Critical, ["UpdateWhere"] = Common.RuleViolationSeverity.Critical, ["UpperLower"] = Common.RuleViolationSeverity.Critical, ["SetVariable"] = Common.RuleViolationSeverity.Critical, }, GenerateDetails = true, }; //var linter = new Linter(con, rep); var fragmentBuilder = new FragmentBuilder(rep, con.CompatibilityLevel); var sqlStreamReaderBuilder = new SqlStreamReaderBuilder(); var bpmn = new BpmnDiagram(); var linter = new Linter(con, rep, fragmentBuilder, sqlStreamReaderBuilder); var diagramer = new Diagramer(bpmn, fragmentBuilder, sqlStreamReaderBuilder); using (StreamReader reader = new StreamReader(@"C:\Users\frost\Downloads\Telegram Desktop\test.sql")) { var name = "test-qwewq-asdcxczc-asdsa -s--sadsasd-dsads-dsa-d-sd--dsa - 0.sql"; Dictionary files = new(); for (int i = 0; i < 15; i++) { files[name + i + ".sql"] = reader.BaseStream; } linter.Run(files); diagramer.Run("test.sql", reader.BaseStream); } //linter.Run(@"C:\Users\frost\Desktop\DISTR-2599\test.sql"); IReportFormatter formatter = new F.v3.HtmlReportFormatter(); var content = formatter.Format(rep.Violations, bpmn); File.WriteAllText(@"C:\Users\frost\Downloads\Telegram Desktop\test3.html", content); formatter = new F.v2.HtmlReportFormatter(); content = formatter.Format(rep.Violations, bpmn); File.WriteAllText(@"C:\Users\frost\Downloads\Telegram Desktop\test2.html", content); formatter = new F.v1.HtmlReportFormatter(); content = formatter.Format(rep.Violations, bpmn); File.WriteAllText(@"C:\Users\frost\Downloads\Telegram Desktop\test1.html", content); } } }