View on GitHub

Cláudio Pinto

Readability Checker

Readability Checker is a plugin for the NetBeans IDE that estimates Java source code readability using three different software readability formulas and metrics.

Main Window

Features

Readability Checker is able to calculate the readability of a project and all its Java files.

The main frame displays the readability of the currently selected Java file. The readability of the selected project and all Java files that it contains can be viewed by selecting the “Detailed Results” option.

The currently selected file is displayed in the main frame.

Readability analysis for a specific formula or metric can be disabled by toggling the “Disable” checkbox.

After checking the readability, the results can be exported to a text file by pressing the “Export Results” button.

Installation

Readability Checker is not yet available on the NetBeans Plugin Portal, it has to be installed manually. These are the install instructions for Apache NetBeans 10.0. Steps may slightly vary for other versions of the IDE.

  1. Download nbm file here
  2. In NetBeans, go to Tools > Plugins > Downloaded > Add Plugins
  3. Select the downloaded readabilitychecker-1.1.0.nbm file
  4. Click Install and follow the instructions

The following icon should now appear in your NetBeans toolbar:

Implemented Formulas and Metrics

Currently, Readability Checker implements three software readability as:

Comments Ratio

Proposed in 2002 by the researchers Krishan K. Aggarwal, Yogesh Singh and Jitender Kumar Chhabra in the article An Integrated Measure of Software Maintainability.

The proposed formula is:

where:

LOC is the number of lines of code

LOM is the number of lines with comments

Implementation notes

SRES

Theorized by Jürgen Börstler, Michael E. Caspersen and Marie Nordström, the general principles of this readability formula were first introduced in 2007, in the article Beauty and the Beast Toward a Measurement Framework for Example Program Quality, then it’s logic was implemented in a readability tool titled Properties of “Good” Java Examples by Nadeem Abbas, and later on, in 2015, the SRES readability formula was finally suggested in the article Beauty and the Beast: on the readability of object-oriented example programs.

The proposed formula is:

where:

ASL is the average sentence length

AWL is the average word length

Implementation notes

B&W

This software readability metric was proposed in 2010 by the researchers Raymond Buse and Westley Weimer in the paper Learning a Metric for Code Readability.

This metric isn’t translated in a specific formula. Instead, some features of the code (e.g. number of identifiers, number of spaces, etc…) are considered to calculate the code readability, using an approach described in the mentioned paper.

This metric was implemented by its authors and is available here. This is the implementation used on Readability Checker.

Implementation notes

* The implementation of this metric doesn’t use a grammar in order to parse the code. This way, the Java version is not significant for this case. Any Java feature will be accepted regardless of the version it was introduced, thus being able to “unofficially” analyze any Java version.

Contact

The source code for this project can be found here. If you have any questions or suggestions, feel free to contact 1120301@isep.ipp.pt.