Code coverage of legacy code

So we are helping teams on baord some legacy projects to sonarqube dev edition. One this we typically have to do is give them an exception on code coverage to allow them to get their code onboarded. They can then address the coverage over time and improve.

My question is how can one eventually fix this? We can remove the restriction and have new code meet the 80% threshold. But all the existing code is ignored.

I realize we can do this manually, but just wondering if I was missing something; it would be nice to be able to say “all code is 80% covered” and not JUST new code?

When you’re ready, you can add a “Coverage is less than” condition on the Quality Gate, but specify that it’s a condition for Overall instead of New code.