Add jetc --lint-sql to find <sql> that pastes values (phase 2)

Implements phase 2 of docs/design-sql-bound-parameters.md. jetc --lint-sql
[--strict] <file|dir>... lists each <sql> whose statement contains a $[...]
or #[...] reference instead of a <bind>, with file:line and where each value
comes from. Row values ($[.col], $[session.col], $[?N], $[#]) are only
reported with --strict. References in <bind>, <if>, <set> and the other
attribute-only tags, <comment> and |> <| are skipped. A custom tag defined
as <sql><container></sql> (barant.com's <showtable>) is checked at each use.
Exit status is 0 for none found, 1 for findings, 2 for an unreadable path.

- jetc/JetLint.*: the scanner; jetc.cpp: the option
- build scripts and runbindtests.sh: link JetLint.cpp
- tests/runlinttests.sh and tests/lintsql/: fixtures and expected output
- docs: worklist for the local copies of both sites, design doc status,
  manual note on the lint

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-11-20 20:29:28 -08:00
1 parent fd81bb877f
commit 2847ce5fa7
22 files changed
+667 -10

No files matched your search

+10
View File
@@ -443,6 +443,16 @@ outside an sql tag, a bind with no value, an unknown type, and a
statement whose number of ? placeholders differs from its number of
bind tags. The error text never contains the bound value itself.
To find the sql tags that still write values into the statement text,
run the jet compiler's lint over a site:
\begin{verbatim}
jetc --lint-sql /path/to/site
\end{verbatim}
It prints the file and line of each one, with the variables it uses.
Add \texttt{-{}-strict} to include values from the rows of an earlier query.
\section{call}
Use the call tag to evoke an executable file from a jet script.