Start breaking the CI job when the SonarQube quality gate fails

Hi devs,

I’d like to propose that we start using SonarQube more to complement our checkstyle usage since SonarQube provides a lot more checks and much better and more interesting in general.

One nice thing is that we can add a new quality gate rule so that it applies only to new code. The old issues are still reported in SonarQube’s UI but they won’t break the quality gate.

The idea would be to start small with the blocker rules defined by Sonar by default (see https://sonarcloud.io/organizations/xwiki/rules?activation=true&qprofile=AXkPFq9x82EFwtQpnbXw&severities=BLOCKER&types=BUG).

So to get started I propose to:

Then, anyone would be free to suggest at any time to set some rules as Blocker. For example, if we agree with this I’ll propose to add Rules explorer as blocker (this is just an example, we can add a lot more).

Ofc, we should also fix the blocker issues on existing code, as a best effort and whenever we can.

WDYT?

Thanks

+1

Thanks,
Marius

+1

Thanks

+1

For those who don’t know about it: there is an IDE extension called sonarlint which works well and will show you those broken rules before you commit.

+1

Thanks,
Alex

I’ve now set it up on sonarcloud and in our Jenkins pipeline ([Misc] Add a step to check the Sonarqube quality gate and fail the bu… · xwiki/xwiki-jenkins-pipeline@0bbf801 · GitHub).

Let’s see if it works at the next build!