build(server): count the bare datetime name the query builder takes

The datetime rule only matched a literal holding a call such as
datetime('now'). The query builder spells the same function as
eb.fn('datetime', [...]), where the literal is just the name, so that form
slipped through while strftime, json_extract and glob are caught bare. A
literal that is exactly datetime, julianday or unixepoch now counts as well,
the same way the glob rule treats a bare glob. The only such call lives in the
dialect layer, which is not scanned, so the baseline does not change.
This commit is contained in:
Maurice
2026-10-08 15:32:26 +02:00
parent 6ef6a7efd2
commit 1d6719347b
3 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -58,7 +58,9 @@ export const RULES = [
},
{
name: 'datetime',
test: (text) => /\b(datetime|julianday|unixepoch)\s*\(/i.test(text),
// The call in SQL text, or the bare name the query builder takes in eb.fn('datetime', [...]).
test: (text) =>
/\b(datetime|julianday|unixepoch)\s*\(/i.test(text) || /^(datetime|julianday|unixepoch)$/i.test(text.trim()),
advice: 'use currentTimestamp/nowMinusDays/nowPlusSeconds and friends from sql-functions.ts',
migrations: true,
},