How helabenkhalfallah/code-health-meter works
Main Components
• • Core Engine (src/index.js): This is the entry point that orchestrates the scanning process.
• • Audit Modules (located under src/kernel):
• Complexity Analysis (src/kernel/complexity): Contains CodeComplexityAuditor, CodeComplexityConfig, and utility functions.
• Duplication Analysis (src/kernel/duplication): Contains CodeDuplicationAuditor for detecting redundant code blocks using the Rabin–Karp algorithm.
• Modularity Analysis (src/kernel/modularity): Contains CodeModularityAuditor and its configuration and helper files for assessing dependencies and coupling.
• • Common Utilities (src/commons): These include shared functions and utilities such as AppLogger, AuditUtils, and Matcher, which support logging, common audit utilities, and pattern matching across different modules.
• • Testing & Reporting: The tests directory contains various mock scans and sample projects along with pre-generated HTML and JSON report examples. This validates how the core engine processes and outputs its analyses.
Relationships and Data Flow
• • Show the Core Engine as the central orchestrator that invokes each audit module.
• • Include Report Generation as a component that collects the outcomes of all audits and formats them into either JSON or HTML, based on configuration parameters passed via the CLI (as shown in the README usage).
Architectural Patterns and Technologies
• • Modular Design: The separation into distinct audit modules (complexity, duplication, modularity) shows a clear separation of concerns.
• • Extensibility: The use of configuration files and shared utilities hints at a design that can be expanded. New audit modules can be incorporated following the established pattern.
• • Integration with External Tools: Note the Graphviz dependency mentioned in the README, which is used for graph-based analysis and visualization.
• • Command Line Interface (CLI): The provided npm and pnpm scripts show that the tool is designed to be run via a command-line interface, receiving parameters such as source directory, output directory, and output format.