Добавьте файлы проекта.
This commit is contained in:
26
SQLLinter/Infrastructure/Rules/BetweenRule.cs
Normal file
26
SQLLinter/Infrastructure/Rules/BetweenRule.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Microsoft.SqlServer.TransactSql.ScriptDom;
|
||||
using SQLLinter.Common;
|
||||
|
||||
namespace SQLLinter.Infrastructure.Rules;
|
||||
|
||||
public class BetweenRule : BaseRuleVisitor
|
||||
{
|
||||
public override string Text => "Избегать BETWEEN, использовать >= и <";
|
||||
|
||||
public override void Visit(TSqlScript node)
|
||||
{
|
||||
base.Visit(node);
|
||||
|
||||
var tokens = node.ScriptTokenStream;
|
||||
if (tokens == null) return;
|
||||
|
||||
foreach (var t in tokens)
|
||||
{
|
||||
if (t.TokenType == TSqlTokenType.Between)
|
||||
{
|
||||
AddViolation(Name, Text, t.Line, t.Column);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user