sonarqubesonarqube-web

How to exclude all legacy issues by date?


We have a lot of legacy code in our repositories, and now we implement SonarQube 6.4 but our legacy code causes a lot of errors and warnings, so we would like to analyze only new written/in the future modified code and exclude the old because we have no resources to amend all issues from legacy code written during last 10 years.

How can I exclude already found issues e.g. by the date they when they were found? But we don't want to exclude all old files as such, because edit them from time to time. We just want to make sure not to add new issues.


Solution

  • SonarQube promotes the idea of a "leak paradigm". In short, the idea is to continously enrich your existing code base with clean, maintainable, secure increments - which will make your code base better over time.

    Fixing all existing issues is not advisable.

    So: define a leak period in SonarQube and change your quality gate to only leak measures. SonarQube is made for exactly your use-case!