@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
31 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 booleans
*
* Detects boolean literals used as arguments without clear meaning.
* Example: doSomething(true, false, true) - hard to understand
* Better: doSomething({ sync: true, validate: false, cache: true })
*/
export declare class AstBooleanAnalyzer {
private readonly contextChecker;
constructor(contextChecker: AstContextChecker);
/**
* Analyzes a boolean node and returns a violation if it's a magic boolean
*/
analyze(node: Parser.SyntaxNode, lines: string[]): HardcodedValue | null;
/**
* Checks if boolean should be detected
*/
private shouldDetect;
/**
* Checks if function call has multiple boolean arguments
*/
private isInFunctionCallWithMultipleBooleans;
/**
* Creates a HardcodedValue violation from a boolean node
*/
private createViolation;
}
//# sourceMappingURL=AstBooleanAnalyzer.d.ts.map