Custom Quality Gate documentation question

I’m trying to get familiar with adding new quality gates so I was reading the documentation documentation. Something confused me in the “Use the best Quality Gate configuration” section:

Don’t forget that Quality Gate conditions must use differential values. For example, there’s no point in checking an absolute value such as: Number of Lines of Code is greater than 1000 .

If there is no point in doing this, how come that’s the only option provided by SonarCloud for measuring number of lines of code?

I feel like I must be misunderstanding something.

Trying to think about it more, maybe I’m confused about what is meant by “differential values.” Can you provide some clarity?


  • If there’s “no point” in doing “Number of Lines of Code is greater than 1000,” why is that metric provided but only in such a way it can be used like that?
  • What is meant by “differential values?”

Hey there.

We’ve discussed making such conditions impossible but the ticket never received enough traction to implement.

Once upon a time, it was possible to set anything as a Quality Gate condition (even “Lines of Code are less than X”, which makes no sense at all).

And at least the operator available to Lines of Code makes a little bit of sense.

The single conceivable reason that “Lines of Code is greater than X” would be an acceptable Quality Gate condition is when trying to limit the number of newlines in a changeset (to enforce small changes on a pull request). And, it’s such a corner case, I’d rather it wasn’t possible at all (and doesn’t really work once changes are merged into a branch and fall into the New Code Period).

It’s a good point that we shouldn’t mention something in the documentation as “having no point” that is possible in the UI.

  • I’ll mention this to our Documentation gurus so we can find a better example, or remove the mention altogether
  • I’ll give a shout to our PMs that such conditions being available (despite being something we’d go so far as discourage in our documentation) are still possible, and confusing to users.

Okay cool, thanks. This was warping my brain a bit. Assumed I was overlooking something.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.