Skip to main content
QUICK REVIEW

[Paper Review] Styler: Learning Formatting Conventions to Repair Checkstyle Errors.

Benjamin Loriot, Fernanda Madeiral|arXiv (Cornell University)|Apr 3, 2019
Software Engineering Research17 references4 citations
TL;DR

STYLER is a deep learning tool that learns project-specific Checkstyle formatting rules using an LSTM-based model to automatically repair 38% of 11,220 real-world Checkstyle errors from 70 GitHub projects. It outperforms existing tools by handling a broader range of Checkstyle rules (24 vs. 17–19) and uniquely fixes two rule types, with fast inference times suitable for IDEs and CI pipelines.

ABSTRACT

Ensuring code formatting conventions is an essential aspect of modern software quality assurance, because it helps in code readability. In this paper, we present STYLER , a tool dedicated to fix formatting errors raised by Checkstyle, a highly configurable format checker for Java. To fix formatting errors in a given project, STYLER 1) learns fixes for self-generated errors according to the project-specific Checkstyle ruleset, based on token sequence fed into a LSTM neural network, and then 2) predicts fixes. In an empirical evaluation, we find that STYLER repairs 38% of 11,220 real Checkstyle errors mined from 70 GitHub projects. Moreover, we compare STYLER with the IntelliJ plugin CHECKSTYLE-IDEA and the machine learning-based code formatters NATURALIZE and CODEBUFF. We find that STYLER fixes errors from a more diverse set of Checkstyle rules (24 rules, compared to CHECKSTYLE-IDEA: 19; NATURALIZE : 20; C ODE B UFF: 17), and it uniquely repairs errors for two rules. Finally, STYLER generates small repairs, and once trained, it predicts repairs in seconds. The promising results suggest that STYLER can be used in IDEs and in Continuous Integration environments to repair Checkstyle errors.

Motivation & Objective

  • To address the challenge of automating the repair of Checkstyle formatting errors in Java projects.
  • To reduce manual effort in fixing repetitive, syntax-level formatting issues that hinder code readability and maintainability.
  • To develop a model that learns from project-specific Checkstyle rules rather than relying on generic formatting heuristics.
  • To enable integration into IDEs and CI/CD pipelines by ensuring fast, accurate, and small-scale repairs.

Proposed method

  • STYLER generates artificial Checkstyle errors based on project-specific rulesets to create a training dataset.
  • It encodes source code tokens into sequences and feeds them into a Long Short-Term Memory (LSTM) neural network.
  • The model is trained to predict the minimal fix required to resolve each artificially generated formatting error.
  • After training, STYLER applies the learned repair policy to real-world Checkstyle errors in production projects.
  • It focuses on minimal, localized changes to preserve code semantics while correcting formatting.
  • The tool is evaluated on real projects from GitHub, using a test set of 11,220 actual Checkstyle violations.

Experimental results

Research questions

  • RQ1Can a deep learning model learn to repair Checkstyle formatting errors with high accuracy using only token sequences and project-specific rules?
  • RQ2How does STYLER's repair coverage compare to existing tools like CHECKSTYLE-IDEA, NATURALIZE, and CODEBUFF in terms of the number of Checkstyle rules supported?
  • RQ3Does STYLER uniquely fix error types not repaired by other tools?
  • RQ4How efficient is STYLER in terms of prediction speed and repair size?
  • RQ5Can STYLER be effectively deployed in real development environments such as IDEs and CI pipelines?

Key findings

  • STYLER successfully repaired 38% of 11,220 real Checkstyle errors mined from 70 GitHub projects.
  • It supports 24 distinct Checkstyle rules, surpassing CHECKSTYLE-IDEA (19), NATURALIZE (20), and CODEBUFF (17).
  • STYLER uniquely repairs errors for two Checkstyle rules not fixed by any of the compared tools.
  • The tool generates small, minimal repairs that preserve code semantics and intent.
  • Once trained, STYLER predicts fixes in seconds, making it suitable for real-time use in IDEs and CI/CD pipelines.
  • The model demonstrates strong generalization to project-specific formatting conventions through self-generated training data.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.