Proceedings of the 11th International Applied Business and Engineering Conference, ABEC 2023, September 21st, 2023, Bengkalis, Riau, Indonesia

Research Article

Decision Tree for Smell Code Detection in Python: A Practical Implementation

Download39 downloads
  • @INPROCEEDINGS{10.4108/eai.21-9-2023.2342883,
        author={Fajar  Ratnawati and Jaroji  Jaroji},
        title={Decision Tree for Smell Code Detection in Python: A Practical Implementation},
        proceedings={Proceedings of the 11th International Applied Business and Engineering Conference, ABEC 2023, September 21st, 2023, Bengkalis, Riau, Indonesia},
        publisher={EAI},
        proceedings_a={ABEC},
        year={2024},
        month={2},
        keywords={smell code decision tree j48 pyhton class duplicated print unused variable parameter machine learning},
        doi={10.4108/eai.21-9-2023.2342883}
    }
    
  • Fajar Ratnawati
    Jaroji Jaroji
    Year: 2024
    Decision Tree for Smell Code Detection in Python: A Practical Implementation
    ABEC
    EAI
    DOI: 10.4108/eai.21-9-2023.2342883
Fajar Ratnawati1,*, Jaroji Jaroji1
  • 1: Politeknik Negeri Bengkalis
*Contact email: fajar@polbeng.ac.id

Abstract

This article discusses the approach to detect code that falls under the category of code smells in the Python programming language. The methodology involves reading each line of code and subsequently analyzing whether the program contains code smells. The code analysis is performed using a model trained with decision tree and J48 algorithms. The aim of this research, apart from developing previous research, is also to improve code quality and reduce security risks. Several aspects considered in this research include the number of parameters within a class, unused variables, duplicated print statements, and the number of classes within a code program. The constructed model utilizing the decision tree algorithm is then implemented into a web-based system, where input code for smell code identification is in the form of files with the extension .py.