Добавьте файлы проекта.

This commit is contained in:
2025-12-07 08:52:05 +03:00
parent 95344cd7a7
commit 226b6b6b21
118 changed files with 5249 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
using Microsoft.SqlServer.TransactSql.ScriptDom;
using SQLLinter.Common;
namespace SQLLinter.Infrastructure.Rules;
public class NestedSubqueryDepthRule : BaseRuleVisitor
{
public override string Text => "Слишком глубокие подзапросы (>" + _maxDepth + "} уровней): {0}";
private int _depth = 0;
private const int _maxDepth = 3;
public override void Visit(QueryDerivedTable node)
{
_depth++;
if (_depth > _maxDepth)
{
AddViolation(node, $"Глубина подзапроса {_depth}");
}
node.QueryExpression.Accept(this);
_depth--;
base.Visit(node);
}
public override void Visit(ScalarSubquery node)
{
_depth++;
if (_depth > _maxDepth)
{
AddViolation(node, $"Глубина подзапроса {_depth}");
}
node.QueryExpression.Accept(this);
_depth--;
base.Visit(node);
}
}