mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-28 07:16:53 +05:00
Refactored three largest detectors to improve maintainability and reduce complexity: - AggregateBoundaryDetector: 381 → 162 lines (57% reduction) - HardcodeDetector: 459 → 89 lines (81% reduction) - RepositoryPatternDetector: 479 → 106 lines (78% reduction) Added 13 new strategy classes: - FolderRegistry - centralized DDD folder name management - AggregatePathAnalyzer - path parsing and aggregate extraction - ImportValidator - import validation logic - BraceTracker - brace and bracket counting - ConstantsFileChecker - constants file detection - ExportConstantAnalyzer - export const analysis - MagicNumberMatcher - magic number detection - MagicStringMatcher - magic string detection - OrmTypeMatcher - ORM type matching - MethodNameValidator - repository method validation - RepositoryFileAnalyzer - file role detection - RepositoryViolationDetector - violation detection logic All 519 tests passing, zero ESLint errors, no breaking changes.
22 lines
657 B
TypeScript
22 lines
657 B
TypeScript
/**
|
|
* Checks if a file is a constants definition file
|
|
*
|
|
* Identifies files that should be skipped for hardcode detection
|
|
* since they are meant to contain constant definitions.
|
|
*/
|
|
export class ConstantsFileChecker {
|
|
private readonly constantsPatterns = [
|
|
/^constants?\.(ts|js)$/i,
|
|
/constants?\/.*\.(ts|js)$/i,
|
|
/\/(constants|config|settings|defaults|tokens)\.ts$/i,
|
|
/\/di\/tokens\.(ts|js)$/i,
|
|
]
|
|
|
|
/**
|
|
* Checks if a file path represents a constants file
|
|
*/
|
|
public isConstantsFile(filePath: string): boolean {
|
|
return this.constantsPatterns.some((pattern) => pattern.test(filePath))
|
|
}
|
|
}
|