Detecting Code Smells in Python Programs

Zhifei Chen, Lin Chen, Wanwangying Ma, Baowen Xu
{"title":"Detecting Code Smells in Python Programs","authors":"Zhifei Chen, Lin Chen, Wanwangying Ma, Baowen Xu","doi":"10.1109/SATE.2016.10","DOIUrl":null,"url":null,"abstract":"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.","PeriodicalId":344531,"journal":{"name":"2016 International Conference on Software Analysis, Testing and Evolution (SATE)","volume":"2 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2016-11-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"22","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2016 International Conference on Software Analysis, Testing and Evolution (SATE)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/SATE.2016.10","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 22

Abstract

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.
作为一种传统的动态语言,Python越来越多地用于各种软件工程任务。然而,由于其灵活性和动态性,Python是一种特别具有挑战性的语言来编写和维护代码。因此,Python程序包含指示潜在理解和维护问题的代码气味。为了支持重构策略以增强可维护性,本文描述了如何检测Python程序中的代码气味。我们介绍了11种Python气味并描述了检测策略。我们还实现了一个名为Pysmell的气味检测工具,并使用它来识别五个真实Python系统中的代码气味。结果表明,Pysmell总共可以检测到285个代码气味实例,平均准确率为97.7%。它揭示了大类和大方法是最普遍的。我们的实验还表明,Python程序可能会进一步受到代码异味的影响。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信