UNPKG

@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

77 lines 2.22 kB
import { IAnemicModelDetector } from "../../domain/services/IAnemicModelDetector"; import { AnemicModelViolation } from "../../domain/value-objects/AnemicModelViolation"; /** * Detects anemic domain model violations * * This detector identifies entities that lack business logic and contain * only getters/setters. Anemic models violate Domain-Driven Design principles. * * @example * ```typescript * const detector = new AnemicModelDetector() * * // Detect anemic models in entity file * const code = ` * class Order { * getStatus() { return this.status } * setStatus(status: string) { this.status = status } * getTotal() { return this.total } * setTotal(total: number) { this.total = total } * } * ` * const violations = detector.detectAnemicModels( * code, * 'src/domain/entities/Order.ts', * 'domain' * ) * * // violations will contain anemic model violation * console.log(violations.length) // 1 * console.log(violations[0].className) // 'Order' * ``` */ export declare class AnemicModelDetector implements IAnemicModelDetector { private readonly entityPatterns; private readonly excludePatterns; /** * Detects anemic model violations in the given code */ detectAnemicModels(code: string, filePath: string, layer: string | undefined): AnemicModelViolation[]; /** * Checks if file should be analyzed */ private shouldAnalyze; /** * Extracts class information from code */ private extractClasses; /** * Extracts properties from class body */ private extractProperties; /** * Extracts methods from class body */ private extractMethods; /** * Analyzes class for anemic model violations */ private analyzeClass; /** * Checks if method name is a getter pattern */ private isGetterMethod; /** * Checks if method is a setter pattern */ private isSetterMethod; /** * Checks if property declaration is actually a method signature */ private isMethodSignature; /** * Gets line number for a position in code */ private getLineNumber; } //# sourceMappingURL=AnemicModelDetector.d.ts.map