Weekly change report

We recently implemented SonarQube for our source code.

We run SonarQube task to kick-off analysis in our nightly build.

Is there anyway to create “dashboard” based on weekly/bi-weekly basis. Things this dash-board could surface are things like new issue found, % of lines checked in without tests or duplicate code etc.

Right now by default SonarQube generate this report based on previous run. Is there a way to run this analysis based on time window? Either manually or automatically.

You might be interested in the governance plugin, available with Enterprise edition and higher.
see https://docs.sonarqube.org/latest/user-guide/portfolios/
But it has no test metrics.

You can change the baseline that is used for the “New Code Period”:
https://docs.sonarqube.org/latest/project-administration/new-code-period/

By default it uses “previous_version” and starts a new period whenever there is a change in the branch version number that is reported to Sonar. But you could also name a specific version or a number of previous days (in older versions, you could also specify a date, but I don’t know if that’s still possible in newer versions, since I don’t see it in the documentation).

So if you don’t shy away from some manual maintenance, you could update your baseline setting once or twice every week to fit your requirements.

(Personally, I prefer the variant where we just set the baseline at the start of the branch and then have the analysis reflect everything that has happened since then. That way we can also see which issues got fixed later on and which are still open. I don’t see the benefit of separating the analysis into individual weeks, since you should “fix the leak” regardless. But that’s just my opinion.)