Enhancing Hotspot Detection with Behavioral Analysis and AI-Assisted Code Review
摘要
Context: Hotspots in software development represent areas of the codebase with high change frequency and complexity, often responsible for a disproportionate share of defects and maintenance costs. Traditional static analysis methods frequently overlook the behavioral and historical context of code evolution, limiting their effectiveness in identifying these critical regions. Objective: This study aims to improve hotspot detection and prioritization by combining behavioral code analysis with AI-assisted code review. The goal is to provide a robust, data-driven method for predicting high-risk areas in software systems, thereby supporting targeted maintenance and reducing technical debt. Method: Author analyzes five commercial software projects using a combination of complexity metrics (cyclomatic and Halstead), historical change data, and evaluations generated by a large language model (LLM). Two hotspot prioritization models are compared: one based solely on code metrics, and another enhanced with AI-generated quality assessments. Results: Across all projects, hotspots identified by the AI-augmented model show improved alignment with defect-prone areas, with higher defect density and lower false-positive rates compared to the traditional approach. In some cases, critical hotspots—covering less than 5% of the code—account for over 50% of recorded defects, demonstrating the model’s predictive accuracy. Conclusions: Integrating AI-driven review with behavioral code analysis offers a more effective and precise approach to hotspot detection. This hybrid method enhances defect prediction, guides maintenance prioritization, and supports long-term code quality in complex, evolving software systems.