@samiyev/guardian
Version:
Research-backed code quality guardian for AI-assisted development. Detects hardcodes, secrets, circular deps, framework leaks, entity exposure, and 9 architecture violations. Enforces Clean Architecture/DDD principles. Works with GitHub Copilot, Cursor, W
34 lines • 1.11 kB
TypeScript
import Parser from "tree-sitter";
import { HardcodedValue } from "../../domain/value-objects/HardcodedValue";
import { AstContextChecker } from "./AstContextChecker";
/**
* AST-based analyzer for detecting magic numbers
*
* Analyzes number literal nodes in the AST to determine if they are
* hardcoded values that should be extracted to constants.
*/
export declare class AstNumberAnalyzer {
private readonly contextChecker;
constructor(contextChecker: AstContextChecker);
/**
* Analyzes a number node and returns a violation if it's a magic number
*/
analyze(node: Parser.SyntaxNode, lines: string[]): HardcodedValue | null;
/**
* Checks if number should be detected based on context
*/
private shouldDetect;
/**
* Checks if name contains configuration keywords
*/
private hasConfigKeyword;
/**
* Checks if context suggests a magic number
*/
private looksLikeMagicNumber;
/**
* Creates a HardcodedValue violation from a number node
*/
private createViolation;
}
//# sourceMappingURL=AstNumberAnalyzer.d.ts.map