Styler: Learning Formatting Conventions to Repair Checkstyle Errors
Formatting coding conventions play an important role on code readability. In this paper, we present Styler, an automatic repair tool dedicated to fix formatting-related errors raised by Checkstyle, a highly configurable format checker for Java. To fix formatting errors in a given project, Styler learns fixes based on the Checkstyle ruleset defined in the project and predicts repairs for the current errors using machine learning. In an empirical evaluation, we found that Styler repaired 24 mined from five GitHub projects. Moreover, in a comparison of Styler with the state-of-the-art machine learning code formatters Naturalize and CodeBuff, we found that Styler is the tool that fixes more real Checkstyle errors and also generates smaller repairs. Finally, we conclude that Styler is promising to be used in IDEs and in a Continuous Integration environment to repair Checkstyle errors.
READ FULL TEXT