Readability models and tools have been proposed to measure the effort to read code. However, these models are not completely able to capture the quality improvements in code as perceived by developers. To investigate possible features for new readability models and production-ready tools, we aim to better understand the types of readability improvements performed by developers when actually improving code readability, and identify discrepancies between suggestions of automatic static tools and the actual improvements performed by developers. We collected 370 code readability improvements from 284 Merged Pull Requests (PRs) under 109 GitHub repositories and produce a catalog with 26 different types of code readability improvements, where in most of the scenarios, the developers improved the code readability to be more intuitive, modular, and less verbose. Surprisingly, SonarQube only detected 26 out of the 370 code readability improvements. This suggests that some of the catalog produced has not yet been addressed by SonarQube rules, highlighting the potential for improvement in Automatic static analysis tools (ASAT) code readability rules as they are perceived by developers.
翻译:可读性模型与工具已被提出用于衡量阅读代码所需的工作量。然而,这些模型尚未能完全捕捉开发者所感知到的代码质量改进。为探究新型可读性模型及生产级工具的可能特征,本研究旨在更深入理解开发者在实际改进代码可读性时执行的各类可读性优化措施,并识别自动化静态工具建议与实际开发者改进之间的差异。我们从109个GitHub仓库的284个已合并拉取请求中收集了370项代码可读性改进案例,构建了包含26种不同代码可读性改进类型的分类目录。研究显示,在大多数场景中,开发者通过使代码更直观、模块化且更简洁来提升可读性。令人意外的是,SonarQube仅检测出370项改进中的26项。这表明本目录中的部分改进类型尚未被SonarQube规则覆盖,凸显了自动化静态分析工具(ASAT)的代码可读性规则——基于开发者实际认知——仍存在优化空间。