STYLE-ANALYZER: fixing code style inconsistencies with interpretable unsupervised algorithms

04/01/2019
by   Vadim Markovtsev, et al.
0

Source code reviews are manual, time-consuming, and expensive. Human involvement should be focused on analyzing the most relevant aspects of the program, such as logic and maintainability, rather than amending style, syntax, or formatting defects. Some tools with linting capabilities can format code automatically and report various stylistic violations for supported programming languages. They are based on rules written by domain experts, hence, their configuration is often tedious, and it is impractical for the given set of rules to cover all possible corner cases. Some machine learning-based solutions exist, but they remain uninterpretable black boxes. This paper introduces STYLE-ANALYZER, a new open source tool to automatically fix code formatting violations using the decision tree forest model which adapts to each codebase and is fully unsupervised. STYLE-ANALYZER is built on top of our novel assisted code review framework, Lookout. It accurately mines the formatting style of each analyzed Git repository and expresses the found format patterns with compact human-readable rules. STYLE-ANALYZER can then suggest style inconsistency fixes in the form of code review comments. We evaluate the output quality and practical relevance of STYLE-ANALYZER by demonstrating that it can reproduce the original style with high precision, measured on 19 popular JavaScript projects, and by showing that it yields promising results in fixing real style mistakes. STYLE-ANALYZER includes a web application to visualize how the rules are triggered. We release STYLE-ANALYZER as a reusable and extendable open source software package on GitHub for the benefit of the community.

READ FULL TEXT
research
06/05/2020

Unsupervised Translation of Programming Languages

A transcompiler, also known as source-to-source translator, is a system ...
research
03/15/2018

Using StackOverflow content to assist in code review

An important goal for programmers is to minimize cost of identifying and...
research
01/25/2022

Leveraging Structural Properties of Source Code Graphs for Just-In-Time Bug Prediction

The most common use of data visualization is to minimize the complexity ...
research
09/13/2022

Exploring Code Style Transfer with Neural Networks

Style is a significant component of natural language text, reflecting a ...
research
04/29/2021

Using Paragraph Vectors to improve our existing code review assisting tool-CRUSO

Code reviews are one of the effective methods to estimate defectiveness ...
research
07/19/2021

Detecting Oxbow Code in Erlang Codebases with the Highest Degree of Certainty

The presence of source code that is no longer needed is a handicap to pr...
research
06/22/2022

Exploring the Impact of Code Style in Identifying Good Programmers

Code style reflects the choice of textual representation of source code....

Please sign up or login with your details

Forgot password? Click here to reset