Detecting Code Smells in Python Programs - Zhifei Chen; Lin Chen; Wanwangying Ma; Baowen Xu (SATE 2016 : proceedings : 2016 International Conference on Software Analysis, Testing and Evolution : 3-4 November 2016, Kunming, Yunnan, China, 2016)
As a traditional dynamic language, Python is increasingly used in various software engineering tasks. However, due to its flexibility and dynamism, Python is a particularly challenging language to write code in and maintain. Consequently, Python programs contain code smells which indicate potential comprehension and maintenance problems. With the aim of supporting refactoring strategies to enhance maintainability, this paper describes how to detect code smells in Python programs. We introduce 11 Python smells and describe the detection strategy. We also implement a smell detection tool named Pysmell and use it to identify code smells in five real world Python systems. The results show that Pysmell can detect 285 code smell instances in total with the average precision of 97.7%. It reveals that Large Class and Large Method are most prevalent. Our experiment also implies Python programs may be suffering code smells further.