Research, Implementation and Analysis of Source Code Metrics in Rust-Code-Analysis
Luca Ardito, Marco Ballario, Michele Valsesia · 2023
The software industry is proliferating at an unprecedented pace, with a massive volume of software being released every day. Among the manifold challenges faced by software engineering researchers, one of the most significant is maintaining and enhancing software quality. Software metrics, designed to quantify various aspects of software, are essential in achieving this goal. They provide developers with a comprehensive snapshot of a codebase’s status throughout its evolution, thereby facilitating timely intervention and continual improvement. Tools like Rust-Code-Analysis (RCA), developed and maintained by Mozilla, serve as crucial aids in this endeavour. RCA is a static code analyser that scrutinises a source code without executing it and computes a series of source code metrics, which quantitatively assess code characteristics such as complexity, maintainability, and robustness. The present article seeks to contribute to this area by undertaking a threefold task. Firstly, we intend to explore new source code Java metrics that can be integrated into RCA. We have chosen Java language due to its not yet declined pervasiveness in many industrial software and world of smartphones. The metrics will be selected based on their potential to provide valuable insights into codebase status and facilitate optimisation. Once the new metrics have been identified, the second part of our task involves implementing these metrics within RCA’s library and also accessed through its CLI. This involves the coding and integration of the metrics using the modern Rust language, taking advantage of its unique features like memory safety without garbage collection, and data concurrency. Finally, to ascertain the effectiveness and reliability of metrics, we conduct an evaluation using diverse Java repositories. This involves studying the values generated by these metrics across repositories of varying sizes and levels of activity. From the smallest library to large-scale applications, our analysis spans various types of repositories, ensuring comprehensive coverage.