mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-22 15:06:32 +00:00
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:
@@ -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,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user