Table of Contents
Fetching ...

Checkstyle+: Reducing Technical Debt Through The Use of Linters with LLMs

Ella Dodor, Cristina V. Lopes

TL;DR

This work tackles the gap where traditional Java linters miss semantically nuanced style violations, contributing to technical debt. It proposes Checkstyle+—a hybrid system that augments Checkstyle with an LLM focused on naming and documentation guidelines from the Google Java Style Guide—and demonstrates improvements in coverage and precision on a real-world Java dataset. Through careful prompt design, model selection, and caching, the approach achieves near-perfect precision/recall on targeted rules while revealing trade-offs in cost and latency, and it highlights educational benefits from natural language feedback. The study offers a practical pathway to more context-aware style enforcement, with strategies to mitigate latency and cost via local models and batching in real-world development workflows.

Abstract

Good code style improves program readability, maintainability, and collaboration, and is an integral component of software quality. Developers, however, often cut corners when following style rules, leading to the wide adoption of tools such as linters in professional software development projects. Traditional linters like Checkstyle operate using rigid, rule-based mechanisms that effectively detect many surface-level violations. However, in most programming languages, there is a subset of style rules that require a more nuanced understanding of code, and fall outside the scope of such static analysis. In this paper, we propose Checkstyle+, a hybrid approach that augments Checkstyle with large language model (LLM) capabilities, to identify style violations that elude the conventional rule-based analysis. Checkstyle+ is evaluated on a sample of 380 Java code files, drawn from a broader dataset of 30,800 real-world Java programs sourced from accepted Codeforces submissions. The results show that Checkstyle+ achieves superior performance over standard Checkstyle in detecting violations of the semantically nuanced rules.

Checkstyle+: Reducing Technical Debt Through The Use of Linters with LLMs

TL;DR

This work tackles the gap where traditional Java linters miss semantically nuanced style violations, contributing to technical debt. It proposes Checkstyle+—a hybrid system that augments Checkstyle with an LLM focused on naming and documentation guidelines from the Google Java Style Guide—and demonstrates improvements in coverage and precision on a real-world Java dataset. Through careful prompt design, model selection, and caching, the approach achieves near-perfect precision/recall on targeted rules while revealing trade-offs in cost and latency, and it highlights educational benefits from natural language feedback. The study offers a practical pathway to more context-aware style enforcement, with strategies to mitigate latency and cost via local models and batching in real-world development workflows.

Abstract

Good code style improves program readability, maintainability, and collaboration, and is an integral component of software quality. Developers, however, often cut corners when following style rules, leading to the wide adoption of tools such as linters in professional software development projects. Traditional linters like Checkstyle operate using rigid, rule-based mechanisms that effectively detect many surface-level violations. However, in most programming languages, there is a subset of style rules that require a more nuanced understanding of code, and fall outside the scope of such static analysis. In this paper, we propose Checkstyle+, a hybrid approach that augments Checkstyle with large language model (LLM) capabilities, to identify style violations that elude the conventional rule-based analysis. Checkstyle+ is evaluated on a sample of 380 Java code files, drawn from a broader dataset of 30,800 real-world Java programs sourced from accepted Codeforces submissions. The results show that Checkstyle+ achieves superior performance over standard Checkstyle in detecting violations of the semantically nuanced rules.
Paper Structure (35 sections, 10 figures, 2 tables)

This paper contains 35 sections, 10 figures, 2 tables.

Figures (10)

  • Figure 1: Example of Checkstyle's False Negatives Caught by Checkstyle+
  • Figure 2: Incorrect Capitalization: Checkstyle vs. Checkstyle+
  • Figure 3: Identifier Descriptiveness: Checkstyle vs. Checkstyle+
  • Figure 4: Excerpt from the LLM prompt used for code style analysis. See Appendix \ref{['sec:prompt']} for the full prompt.
  • Figure 5: Checkstyle's Standard Output
  • ...and 5 more figures