Detecting Code Smells in Python Programs

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...

Full description

Saved in:
Bibliographic Details
Published in:SATE 2016 : proceedings : 2016 International Conference on Software Analysis, Testing and Evolution : 3-4 November 2016, Kunming, Yunnan, China pp. 18 - 23
Main Authors: Zhifei Chen, Lin Chen, Wanwangying Ma, Baowen Xu
Format: Conference Proceeding
Language:English
Published: IEEE 01.11.2016
Subjects:
Online Access:Get full text
Tags: Add Tag
No Tags, Be the first to tag this record!
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.
AbstractList 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.
Author Baowen Xu
Lin Chen
Zhifei Chen
Wanwangying Ma
Author_xml – sequence: 1
  surname: Zhifei Chen
  fullname: Zhifei Chen
  email: chenzhifei@smail.nju.edu.cn
  organization: State Key Lab. of Novel Software Technol., Nanjing Univ., Nanjing, China
– sequence: 2
  surname: Lin Chen
  fullname: Lin Chen
  email: lchen@nju.edu.cn
  organization: State Key Lab. of Novel Software Technol., Nanjing Univ., Nanjing, China
– sequence: 3
  surname: Wanwangying Ma
  fullname: Wanwangying Ma
  email: wwyma@smail.nju.edu.cn
  organization: State Key Lab. of Novel Software Technol., Nanjing Univ., Nanjing, China
– sequence: 4
  surname: Baowen Xu
  fullname: Baowen Xu
  email: bwxu@nju.edu.cn
  organization: State Key Lab. of Novel Software Technol., Nanjing Univ., Nanjing, China
BookMark eNotjj1PwzAUAI0EErR0Y2PJyJL0vdjOs8cqlA-pUpFa5iqOX4pRPlCcpf-eSDDdcNLpFuK6H3oW4gEhQwS7PmyO2ywHLDKEK7FADRaURsJbsYrxGwDQFiZX9k48PfPE9RT6c1IOnpNDx20bk9AnH5fpa5gxDuex6uK9uGmqNvLqn0vx-bI9lm_pbv_6Xm52aUDSUyrB5Y482FqTM74haTVBZXJUjkgpPztpC6Vr6byvvMnJcgHNfMvKeSWX4vGvG5j59DOGrhovJyIDaIz8BY0kPpg
CODEN IEEPAD
ContentType Conference Proceeding
DBID 6IE
6IL
CBEJK
RIE
RIL
DOI 10.1109/SATE.2016.10
DatabaseName IEEE Electronic Library (IEL) Conference Proceedings
IEEE Xplore POP ALL
IEEE Xplore All Conference Proceedings
IEEE Electronic Library (IEL) - NZ
IEEE Proceedings Order Plans (POP All) 1998-Present
DatabaseTitleList
Database_xml – sequence: 1
  dbid: RIE
  name: IEEE Electronic Library (IEL) - NZ
  url: https://ieeexplore.ieee.org/
  sourceTypes: Publisher
DeliveryMethod fulltext_linktorsrc
Discipline Computer Science
EISBN 1509045171
9781509045174
EndPage 23
ExternalDocumentID 7780188
Genre orig-research
GroupedDBID 6IE
6IF
6IK
6IL
6IN
AAJGR
AAWTH
ADFMO
ALMA_UNASSIGNED_HOLDINGS
BEFXN
BFFAM
BGNUA
BKEBE
BPEOZ
CBEJK
IEGSK
IERZE
OCL
RIE
RIL
ID FETCH-LOGICAL-i175t-30b2b7d09c57b8df739570a8214b7744d7d039645c3bddad8279e60f201e4bd43
IEDL.DBID RIE
ISICitedReferencesCount 30
ISICitedReferencesURI http://www.webofscience.com/api/gateway?GWVersion=2&SrcApp=Summon&SrcAuth=ProQuest&DestLinkType=CitingArticles&DestApp=WOS_CPL&KeyUT=000390672200004&url=https%3A%2F%2Fcvtisr.summon.serialssolutions.com%2F%23%21%2Fsearch%3Fho%3Df%26include.ft.matches%3Dt%26l%3Dnull%26q%3D
IngestDate Wed Aug 27 01:57:10 EDT 2025
IsPeerReviewed false
IsScholarly false
Language English
LinkModel DirectLink
MergedId FETCHMERGED-LOGICAL-i175t-30b2b7d09c57b8df739570a8214b7744d7d039645c3bddad8279e60f201e4bd43
PageCount 6
ParticipantIDs ieee_primary_7780188
PublicationCentury 2000
PublicationDate 2016-Nov.
PublicationDateYYYYMMDD 2016-11-01
PublicationDate_xml – month: 11
  year: 2016
  text: 2016-Nov.
PublicationDecade 2010
PublicationTitle SATE 2016 : proceedings : 2016 International Conference on Software Analysis, Testing and Evolution : 3-4 November 2016, Kunming, Yunnan, China
PublicationTitleAbbrev SATE
PublicationYear 2016
Publisher IEEE
Publisher_xml – name: IEEE
SSID ssj0001968249
Score 1.7651367
Snippet As a traditional dynamic language, Python is increasingly used in various software engineering tasks. However, due to its flexibility and dynamism, Python is a...
SourceID ieee
SourceType Publisher
StartPage 18
SubjectTerms code smells
Computer architecture
Maintenance engineering
Manuals
Measurement
program maintenance
Programming
Python
refactoring
Software
Syntactics
Title Detecting Code Smells in Python Programs
URI https://ieeexplore.ieee.org/document/7780188
WOSCitedRecordID wos000390672200004&url=https%3A%2F%2Fcvtisr.summon.serialssolutions.com%2F%23%21%2Fsearch%3Fho%3Df%26include.ft.matches%3Dt%26l%3Dnull%26q%3D
hasFullText 1
inHoldings 1
isFullTextHit
isPrint
link http://cvtisr.summon.serialssolutions.com/2.0.0/link/0/eLvHCXMwlV1LTwIxEJ4A8eAJFYzv9ODBg4W62227R4MQT2QTMOFG-tqEBBcDi4n_3s6CiwcvXpqmbdpMm-m0M_PNANwzqyMbcUtZbDTlgjOKMVgoc0mecK1jnZsq2YQcj9VslmYNeKyxMN77yvnM97Ba2fLdym5RVdaXMtynSjWhKaXYYbUO-pRUqPCVqH3b0_7keTpE3y3RQ3jsr9wplegYtf-36Al0Dxg8ktXS5RQavjiD9k8SBrLnyQ48vHi0A4QxZLBynkze_XK5IYuCZF8YFwAnQQ-sTRfeRsPp4JXu0x_QRZDpJY2ZiYx0LLWJNMrllUmNaRU9cRMebdyFvjgVPLGxcU47FcnUC5YHkj03jsfn0CpWhb8AosJDhDseGNjnWGqXY6D18PXTXAQOvoQOEj7_2EW4mO9pvvq7-RqOcVt3iLwbaJXrrb-FI_tZLjbru-pYvgH0Loy3
linkProvider IEEE
linkToHtml http://cvtisr.summon.serialssolutions.com/2.0.0/link/0/eLvHCXMwlV1LTwIxEJ4gmugJFYxve_DgwULdnd3tHg1CMCIhARNupK9NSHDXwGLiv7fdRfDgxUvTtE2baTOddma-GYBbpoSnPFSU-VJQDJFRF4OFMh0kAQrhi0QWySaiwYBPJvGwAvcbLIwxpnA-M01XLWz5OlMrpyprRZG9Tznfgd0A0WMlWmurUYlDbj8TG-_2uDV6HHec91bYdADZX9lTCuHRrf1v2UNobFF4ZLiRL0dQMekx1H7SMJA1V9bh7sk4S4AdQ9qZNmT0bubzJZmlZPjlIgO4SZwP1rIBb93OuN2j6wQIdGalek59Jj0ZaRarIJJcJ4VRjQnuPaC0zzbUts-PQwyUL7UWmntRbEKWWJINSo3-CVTTLDWnQLh9iqBGy8ImcaXQiQu1bj9_AkPLw2dQd4RPP8oYF9M1zed_N9_Afm_82p_2nwcvF3DgtrjE511CNV-szBXsqc98tlxcF0f0DXuhj_4
openUrl ctx_ver=Z39.88-2004&ctx_enc=info%3Aofi%2Fenc%3AUTF-8&rfr_id=info%3Asid%2Fsummon.serialssolutions.com&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=proceeding&rft.title=SATE+2016+%3A+proceedings+%3A+2016+International+Conference+on+Software+Analysis%2C+Testing+and+Evolution+%3A+3-4+November+2016%2C+Kunming%2C+Yunnan%2C+China&rft.atitle=Detecting+Code+Smells+in+Python+Programs&rft.au=Zhifei+Chen&rft.au=Lin+Chen&rft.au=Wanwangying+Ma&rft.au=Baowen+Xu&rft.date=2016-11-01&rft.pub=IEEE&rft.spage=18&rft.epage=23&rft_id=info:doi/10.1109%2FSATE.2016.10&rft.externalDocID=7780188