27 lines
631 B
C#
27 lines
631 B
C#
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);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|