Improving Semantic Consistency of Variable Names with Use-Flow Graph Analysis
Yusuke Shinyama, Yoshitaka Arahori, Katsuhiko Gondow

TL;DR
This paper introduces a project-specific, source code-based method to analyze and improve the semantic consistency of variable names, enhancing code maintainability without external knowledge.
Contribution
It presents a novel approach that learns naming conventions from source code and suggests semantically consistent variable names, with practical validation on open-source projects.
Findings
Proposed variable name suggestions for 39% of inconsistent instances.
Generated patches adopted by three open-source projects.
System effectively identifies and corrects semantic inconsistencies in variable names.
Abstract
Consistency is one of the keys to maintainable source code and hence a successful software project. We propose a novel method of extracting the intent of programmers from source code of a large project (~300kLOC) and checking the semantic consistency of its variable names. Our system learns a project-specific naming convention for variables based on its role solely from source code, and suggest alternatives when it violates its internal consistency. The system can also show the reasoning why a certain variable should be named in a specific way. The system does not rely on any external knowledge. We applied our method to 12 open-source projects and evaluated its results with human reviewers. Our system proposed alternative variable names for 416 out of 1080 (39%) instances that are considered better than ones originally used by the developers. Based on the results, we created patches to…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
