using SQLLinter.Infrastructure.Configuration; using SQLLinter.Infrastructure.Diagram; using SQLLinter.Infrastructure.Parser; using SQLLinter.Infrastructure.Reporters; 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, } }; //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")) { linter.Run("test.sql", reader.BaseStream); diagramer.Run("test.sql", reader.BaseStream); } //linter.Run(@"C:\Users\frost\Desktop\DISTR-2599\test.sql"); var formatter = new HtmlReportFormatter(); var content = formatter.Format(rep.Violations, bpmn); File.WriteAllText(@"C:\Users\frost\Downloads\Telegram Desktop\test.html", content); } } }