Files
SQLLint/SQLLinter.CLI/Program.cs

59 lines
2.9 KiB
C#

using SQLLinter.Infrastructure.Configuration;
using SQLLinter.Infrastructure.Reporters;
namespace SQLLinter.CLI
{
internal class Program
{
static void Main(string[] args)
{
var rep = new MarkdownFileReporter();
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);
using (StreamReader reader = new StreamReader(@"C:\Users\frost\Desktop\DISTR-2599\test.sql"))
{
linter.Run("test.sql", reader.BaseStream);
}
//linter.Run(@"C:\Users\frost\Desktop\DISTR-2599\test.sql");
rep.SaveReport(@"C:\Users\frost\Desktop\DISTR-2599\test.md");
}
}
}