Our project management has a new special requirement regarding Quality Gates.
For example: The QG should fail, if
(1) the cyclomatic complexity of a method is greater than X
AND (2) the code coverage of this method is less than Y.
Is it possible to combine several conditions to create such a “conditional condition”?
Can Sonarqube (we’re using Version 6.7.1) do this out-of-the-box?
Quality Gate conditions are set on project-level measures.
There are no project-level measures on method-level values
There’s no way to set up x && y conditions
That said, this might be accomplishable with some ingenuity and tolerance:
Write a custom rule (I’ll assume Code Smell) that raises an issue when both conditions are met
Add the rule to you profile as a Blocker
Add a Quality Gate condition on Blocker Code Smells. Note that the condition will fail on any Blocker Code Smells, not just on violations of your rule. That’s the “tolerance” part.
If you decide to pursue this, feel free to come back to us with new ‘Plugin Development’ threads when you have specific development questions. Assuming you’re talking about a language with an open source analyzer, the existing rules on these metrics will give you a good head start on implementation.