Expand description
Static analysis for Pine Script ASTs.
pine-lint walks a parsed pine_ast::Program and reports likely bugs and
non-idiomatic constructs as Diagnostics. It is organized around three
pieces:
Visitor+ thewalk_*functions — the reusable traversal core.LintPass— one check; a visitor that collects diagnostics.lint— the driver that runs every registered pass over a program.
§Example
use pine_ast::Program;
use pine_lexer::Lexer;
use pine_parser::Parser;
let src = "x = close == na\n";
let tokens = Lexer::new(src).tokenize().unwrap();
let program = Program::new(Parser::new(tokens).parse().unwrap());
let diagnostics = pine_lint::lint(&program);
assert_eq!(diagnostics.len(), 1);
assert_eq!(diagnostics[0].rule, "eq-na");Structs§
- Diagnostic
- A single finding from any analysis phase.
Enums§
- Severity
- How serious a finding is.
Traits§
Functions§
- lint
- Run every built-in lint pass over
programand return all findings, sorted by line for stable, readable output. - lint_
with - Run a specific set of passes. Useful for tests that want to exercise one check in isolation.
- walk_
block - walk_
expr - walk_
program - walk_
stmt