一句话:提出开源工具 Namesake,检测 Python 程序中标示符命名在拼写、发音或语义上易混淆的组合。
标识符命名是程序理解的重要信息来源,而相似的命名可能妨碍代码理解与维护。本文介绍开源工具 Namesake,用于评估 Python 程序中容易混淆的命名组合。该工具从程序的抽象语法树中提取标识符,拆分复合名称,并对每一对名称在正字法(词形)、语音(发音)和语义(含义)三个维度上计算相似性。若发现可能有问题的标识符组合,工具会连同行号一并标记给程序员。Namesake 可与现有代码风格检查器配合使用,帮助提升命名质量,并能方便地集成到 DevOps 流水线中进行自动化检查与命名评估。摘要未报告用户研究或量化基准结果。
Identifier naming is one of the main sources of information in program comprehension, where a significant portion of software development time is spent. Previous research shows that similarity in identifier names could potentially hinder code comprehension, and subsequently code maintenance and evolution. In this paper, we present an open-source tool for assessing confusing naming combinations in Python programs. The tool which we call Namesake, flags confusing identifier naming combinations that are similar in orthography (word form), phonology (pronunciation), or semantics (meaning). Our tool extracts identifier names from the abstract syntax tree of a program, splits compound names, and evaluates the similarity of each pair in orthography, phonology, and semantics. Problematic identifier combinations are flagged to programmers along with their line numbers. In combination with existing coding style checkers, Namesake can provide programmers with an additional resource to enhance identifier naming quality. The tool can be integrated easily in DevOps pipelines for automated checking and identifier naming appraisal.
DOI 原文 ·
@inproceedings{paperbot7264,
title = {Namesake: A Checker of Lexical Similarity in Identifier Names},
author = {Naser Al Madi},
booktitle = {ASE},
year = {2022},
doi = {10.1145/3551349.3560441}
}