Documentation
¶
Overview ¶
Package scriptlex holds the lexical checks a managed script's source is put through before it is parsed: the Python instincts an agent brings to a Starlark file, answered with what to write instead, and the credential-shaped strings that must never be stored in one.
It reads text and nothing else. The checks that need the parse tree -- what a script reaches, the reserved words, the destinations -- stay with the validator in internal/platform/scriptrun, which folds these findings into its report.
Index ¶
Constants ¶
const ( SeverityError = "error" SeverityWarning = "warning" )
Finding severities. An error means the script cannot run as written; a warning means it will run but somebody should look.
Variables ¶
This section is empty.
Functions ¶
func CodeOnly ¶
CodeOnly returns source with the contents of every string literal and every comment replaced by spaces, keeping the quotes, the newlines and every byte offset. The author-facing lexical checks read it instead of the raw text, so a string whose content is `f`, or a SQL column named datetime, is not taken for code (#1853). An unterminated literal is masked to the end of its line (or of the source, for a triple-quoted one); the parser reports it.