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

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,26 @@
using Microsoft.SqlServer.TransactSql.ScriptDom;
using SQLLinter.Common;
namespace SQLLinter.Infrastructure.Rules;
public class InsertValuesInsteadOfSelectRule : BaseRuleVisitor
{
public override string Text => "Для вставки константных значений используйте VALUES(...)";
public override void Visit(InsertStatement node)
{
// Проверяем, что источник данных - SELECT
if (node.InsertSpecification.InsertSource is SelectInsertSource selectSource)
{
var query = selectSource.Select as QuerySpecification;
if (query != null)
{
// Если в SELECT нет таблиц (т.е. просто SELECT 1,2,3)
if (query.FromClause == null || query.FromClause.TableReferences.Count == 0)
{
AddViolation(Name, Text, GetLineNumber(node), GetColumnNumber(node));
}
}
}
}
}