Code smells are symptoms of poor design and implementation in the code, which do not directly affect the functionality, but affect various aspects of the software such as readability, maintainability, and quality. Early identification is key in avoiding technical debt and in maintaining sustainable codebases. However, traditional heuristic and machine learning (ML)-based techniques tend to have low precision, scalability problems, and are not effective in dealing with class imbalance. In this paper, we propose CodeSmellSynergy, a novel hybrid approach for the detection of design smells in Python that applies heuristic pre-filtering and feature engineering, balances classes, and combines heterogeneous ML and deep learning (DL) classifiers through stacking and voting. The framework is tested on a publicly available dataset of 1000 labeled samples for the Long Method and Large Class smells. The proposed method obtains 97.08% accuracy and a Matthews Correlation Coefficient (MCC) of 0.9427 for Long Method detection, and 93.75% accuracy with an MCC of 0.8752 for Large Class detection using stratified five-fold cross-validation. The paired Wilcoxon signed-rank test is used to verify the statistical significance of improvements over the strong baseline models. The results demonstrate that learning an ensemble with heuristic transparency enhances robustness and interpretability in detecting code smells.
Kumar et al. (Tue,) studied this question.