2025
Conférence
IEEE Congress on Evolutionary Computation (CEC)
Code smells signal poor software design that can prevent maintainability and scalability. Identifying code smells is difficult because of the large volume of code, considerable detection expenses, and the substantial effort needed for manual tagging. Although current techniques perform well in within-project situations, they frequently struggle to adapt to cross-project environments that have varying data distributions. In this paper, we introduce CLADES (Cross-project Learning and Adaptation for Detection of Code Smells), a hybrid evolutionary approach consisting of three main modules: Initialization, Evolution, and Adaptation. The first module generates an initial population of decision tree detectors using labeled within-project data and evaluates their quality through fitness functions based on structural code metrics. The evolution module applies genetic operators (selection, crossover, and mutation) to create new offspring solutions. To handle cross-project scenarios, the adaptation module employs a clustering-based instance selection technique that identifies representative instances from new projects, which are added to the dataset and used to repair the decision trees through simulated annealing. These locally refined decision trees are then evolved using a genetic algorithm, thus enabling continuous adaptation to new project instances. The resulting optimized decision tree detectors are then employed to predict labels for the new unlabeled project instances. We assess CLADES across five open-source projects and we show that it has a better performance with respect to baseline techniques in terms of weighted F1-score and AUC-PR metrics. These results emphasize its capacity to effectively adjust to different project environments, facilitating precise and scalable detection of code smells while minimizing the need for manual review, contributing to more robust and maintainable software systems.
@inproceedings{boutaib2025crossproject, author = {Boutaib, Sofien and Elarbi, Maha and Bechikh, Slim and Coello Coello, Carlos A. and Ben Said, Lamjed}, title = {Cross-Project Code Smell Detection as a Dynamic Optimization Problem: An Evolutionary Memetic Approach}, booktitle = {CEC 2025: Proceedings of the IEEE Congress on Evolutionary Computation}, pages = {1--9}, year = {2025}, publisher = {IEEE}, }