Authors: João Pedro Schmitt, Fabiano Baldo


Developer teams are continuously required to be more productive and eficient during software development to attend market demands. Additionally, despite the software growing complexity pushed by development tasks, these teams are asked to produce code with better quality in order to increase the code readability for future refactoring. This scenario brings the opportunity of proposing new metrics able to qualify a given source code. This kind of metric could help developers to improve their source code and, en hence, mitigate the software quality degradation along the time caused by new requirements and market pressures. Due to this fact, this work proposes a complexity and entropy-based metric used to calculate the quality of a given source code. Besides that, it is presented a plug-in for a Java code editor that implements this metric and compares the quality of existing source codes of the same software project. To validate the metric, it has been selected a development team based on Java stack responsible by one single software product. In this team, a case study was conducted to analyze if the metric is capable to measure the source code quality as well as stimulate the software quality improvement. The obtained results have shown that the proposed metric is suitable to help improving the software quality by its ability of measuring the source code shortcomings.

Project available at Research Gate. DOI: 10.13140/RG.2.2.32518.19520. For more information see the PDF Paper.

Building project

mvn clean install -DskipTests
mvn spring-boot:run 

Simple test

After start the spring boot application. Access: http://localhost:8080/ to see the main source code analyzer page. Past any source code for analysis and click on Calculate. For example:

Simple calculation

This image shows an example of calculated source code ranking. In this case the statistic is 1.96.

Loading source codes to database

The project has some sample source codes to load a sample database (h2), they are store in the /resources folder. To start the ETL, open the following URL in the browser: http://localhost:8080/etl. In case of Regex error, try again.

After the ETL has finished, open the following URL to query the database: http://localhost:8080/metrics?page=0&limit=100. See the image below:

Query database

If you want to see the database structure. Access the URL http://localhost:8080/h2-console and provide the following information (the password is password):

Login database

Then you will have access to the database.

Select database