DR-Tools Smell Churn is a tool that works alongside DR-Tools Code Health and the version control system.
Following the same development principles adopted in the DR-Tools Suite, it is a simple-to-use tool that takes as input two files generated from a temporal analysis performed with DR-Tools Code Health, combined with Git to retrieve previous versions.
DR-Tools Smell Churn introduces the implementation of a new analysis metric, called smell churn, which allows the evaluation of which code smells were removed, added, or are still present between two analyzed versions.
The basis for creating this metric to assess the insertion/removal of smells is a well-known and widely adopted concept in Software Engineering: code churn. Code churn is used to describe the rate of code modification — or churn rate — over time. It measures the amount of changes made to a specific set of files or lines of code during a defined period, such as a development iteration, a build cycle, or the implementation of a specific feature.
This concept is fundamental to understanding the dynamics of software development and maintenance. It can be calculated in different ways, including counting added, removed, and modified lines of code, the number of commits or revisions made in a given period, or even the number of times a file has been changed. Code churn provides valuable insights into development activity and code stability, and can be used to identify critical areas that require more attention or refactorings.DR-Tools Smell Churn uses the open data provided by DR-Tools Code Health to perform its analysis.
Based on the CSV files generated by the tool, it is possible to evaluate the smell churn metric by considering the code smells and the levels of granularity currently supported by DR-Tools Code Health.
The output can be displayed in the console or exported in CSV format, consolidating the results between two system versions.
In the project evolution analysis, an initial version (e.g., v0) is compared with a later version (e.g., v1), verifying whether there has been improvement, degradation, or stability regarding the presence of code smells.
To use it, follow these steps:
prompt> git clone poc-project
prompt> git checkout v1
prompt> drtools-code-health \repo\poc-project\src --analyze \temp\poc-project\v1
prompt> git checkout v2
prompt> drtools-code-health \repo\poc-project\src --analyze \temp\poc-project\v2
prompt> smell-churn -console
\temp\poc-project\v1\.drtools\analysis\20231012_1339_poc-project\smells\drtools-smells-methods.csv
\temp\poc-project\v2\.drtools\analysis\20231012_1339_poc-project\smells\drtools-smells-methods.csv