Documentation
¶
Overview ¶
Package keywordcase reports PostgreSQL keywords that are not written in lowercase, per the gomatic SQL standard (keywords are lowercase; uppercase and title-case are the error). It tokenizes SQL with the shared gomatic/go-sql library — a thin wrapper over libpg_query, PostgreSQL's own lexer — and flags any keyword token whose text is not already its lowercase form. Quoted identifiers and keyword text inside string literals are not keyword tokens, so they are never flagged.
Index ¶
Constants ¶
const ErrReadFile errs.Const = "cannot read SQL file"
ErrReadFile reports that a SQL source file could not be read.
const Rule = "yze-sql/keywordcase"
Rule is the stable rule id every diagnostic carries.
const Tool = "yze-sql"
Tool is the runner name stamped on every diagnostic, matching the yze-sql family.
Variables ¶
This section is empty.
Functions ¶
func Diagnostics ¶
func Diagnostics(path, source string) ([]goyze.Diagnostic, error)
Diagnostics reports every keyword token in source whose text is not its canonical lowercase spelling. A lexical error scanning source is returned (wrapped in sql.ErrScan) so the caller can surface it as a tool failure rather than a clean pass. path is stamped on each diagnostic's location. Positions are computed in a single forward pass over source, so a file of any size costs O(n).
Types ¶
type FileReader ¶
FileReader reads a file's bytes; injected so aggregation is testable without the filesystem.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
yze-sql-keywordcase
command
Command yze-sql-keywordcase reports PostgreSQL keywords that are not written in lowercase in the given .sql files and directories, emitting the lean stickler-json report the stickler runner consumes.
|
Command yze-sql-keywordcase reports PostgreSQL keywords that are not written in lowercase in the given .sql files and directories, emitting the lean stickler-json report the stickler runner consumes. |