Static Analysis โ
Problem โ
Lint rules ("no empty blocks", "no magic numbers") need reliable patterns over code shape.
Why tree-sitter.zig helps โ
Each rule is a query; violations are matches with exact ranges for diagnostics.
API โ
Query / QueryCursor with setByteRange scoping per file region.
Architecture โ
text
Rules as queries โ execute per file โ matches become diagnosticsExample โ
(number) @magic finds every numeric literal; predicates narrow to suspicious values.
