Gather git commit statistics to identify code changed often and prioritize findings

  • What are you trying to accomplish?
    We have a very huge legacy codebase and we are already using the “new code only” strategy to measure and for quality gates. We want to have an additional way to prioritize code which has to be fixed. We think code which has been changed very often is a good point to look at, especially combined with cognitive complexity. We want to gather this information from the git history (count of commits) for each LoC(?) / method / class / file.

  • Why does this matter to you?
    We need further assistance to deal with legacy code. We want to rely on the “new code only” strategy to “force” improvements, but we need some softer way to deal with existing code.

  • How would that look in SonarQube? Alternatives?
    This should be an attribute which can be used as “filter” below “issues”. Maybe it would be usefull to have it visible close as counter next to the code view.
    A summary could be presented in the Quality Gate: Code not beeing “new” but changed often and the corresponding number of findings, including a trend.

  • How would we know it works well?
    Findings decrease in legacy code because developers accept this a good place to look at.

  • Why should it be a priority now?
    There is a startup competitor in the market overing exactly this feature, and having a SonarQube importer to profit from the findings. They are very active and doing a roadshow.