跳到主要导航 跳到搜索 跳到主要内容

一种基于词法特征和数据挖掘的无意义变量名检测方法

  • Yanjie Jiang*
  • , Chunhao Dong
  • , Hui Liu
  • *此作品的通讯作者
  • Peking University
  • Beijing Institute of Technology

科研成果: 期刊稿件文章同行评审

摘要

Identifiers is an important part of code,and it is also one of the key elements for people to understand the semantics of code.Variables are widely used to represent objects in programs.Names of such variables could serve as a major clue to the responsibility of the variables if they are serious and properly named.However,unqualified variable names(e.g.,“a”,“var”) are constructed frequently by developers.Such nonsense variable names have a severe negative impact on the readability and maintai-nability of software applications.So,automated identification of bad smells is one of the hot topics in the field of software refacto-ring.To identify such nonsense names automatically,we conduct an empirical study to figure out the key features that could be exploited to distinguishing nonsense names from well-constructed meaningful ones.Results of the study suggest that nonsense variable names are often short and rarely contain meaningful words.To this end,in this paper,we propose a heuristics and data mining-based approach to identifying nonsense variable names.It first retrieves suspicious variable names based on lexical analysis.On the resulting suspicious names,it conducts an abbreviation expansion-based filtering to exclude such variable names that are carefully constructed to represent the abbreviations of meaningful words.Finally,it conducts data mining-based filtering to further exclude well-known symbols(e.g.“i”,“e”).Experimental results on open source datasets show that the proposed method has high accuracy.Its average precision and recall is 85% and 91.5%,respectively.

投稿的翻译标题Nonsense Variable Names Detection Method Based on Lexical Features and Data Mining
源语言繁体中文
页(从-至)23-33
页数11
期刊Computer Science
51
6
DOI
出版状态已出版 - 15 6月 2024
已对外发布

关键词

  • Code quality
  • Data mining
  • Lexical features
  • Nonsense variable names
  • Software refactoring

学术指纹

探究 '一种基于词法特征和数据挖掘的无意义变量名检测方法' 的科研主题。它们共同构成独一无二的学术指纹。

引用此