@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
48 lines • 2.07 kB
TypeScript
import { INamingConventionDetector } from "../../domain/services/INamingConventionDetector";
import { NamingViolation } from "../../domain/value-objects/NamingViolation";
/**
* Detects naming convention violations using AST-based analysis
*
* This detector uses Abstract Syntax Tree (AST) analysis via tree-sitter to identify
* naming convention violations in classes, interfaces, functions, and variables
* according to Clean Architecture layer rules.
*
* The detector uses a modular architecture with specialized components:
* - AstClassNameAnalyzer: Analyzes class names
* - AstInterfaceNameAnalyzer: Analyzes interface names
* - AstFunctionNameAnalyzer: Analyzes function and method names
* - AstVariableNameAnalyzer: Analyzes variable and constant names
* - AstNamingTraverser: Traverses the AST and coordinates analyzers
*
* @example
* ```typescript
* const detector = new NamingConventionDetector()
* const code = `
* class userService { // Wrong: should be UserService
* GetUser() {} // Wrong: should be getUser
* }
* `
* const violations = detector.detectViolations(code, 'UserService.ts', 'domain', 'src/domain/UserService.ts')
* // Returns array of NamingViolation objects
* ```
*/
export declare class NamingConventionDetector implements INamingConventionDetector {
private readonly parser;
private readonly traverser;
constructor();
/**
* Detects naming convention violations in the given code
*
* @param content - Source code to analyze
* @param fileName - Name of the file being analyzed
* @param layer - Architectural layer (domain, application, infrastructure, shared)
* @param filePath - File path for context (used in violation reports)
* @returns Array of detected naming violations
*/
detectViolations(content: string, fileName: string, layer: string | undefined, filePath: string): NamingViolation[];
/**
* Parses code based on file extension
*/
private parseCode;
}
//# sourceMappingURL=NamingConventionDetector.d.ts.map