@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
39 lines • 1.22 kB
TypeScript
import Parser from "tree-sitter";
import { HardcodedValue } from "../../domain/value-objects/HardcodedValue";
import { AstContextChecker } from "./AstContextChecker";
/**
* AST-based analyzer for detecting magic strings
*
* Analyzes string literal nodes in the AST to determine if they are
* hardcoded values that should be extracted to constants.
*
* Detects various types of hardcoded strings:
* - URLs and connection strings
* - Email addresses
* - IP addresses
* - File paths
* - Dates
* - API keys
*/
export declare class AstStringAnalyzer {
private readonly contextChecker;
private readonly patternMatcher;
constructor(contextChecker: AstContextChecker);
/**
* Analyzes a string node and returns a violation if it's a magic string
*/
analyze(node: Parser.SyntaxNode, lines: string[]): HardcodedValue | null;
/**
* Checks if string value should be detected
*/
private shouldDetect;
/**
* Checks if string is in a configuration-related context
*/
private hasConfigurationContext;
/**
* Creates a HardcodedValue violation from a string node
*/
private createViolation;
}
//# sourceMappingURL=AstStringAnalyzer.d.ts.map