Search code examples
sonarqubesonar-runnersonarqube-scan

Is there a way to instruct sonar scanner to exclude issues related with legacy code?


I want sonar scanner to run on a legacy project but capture only new issues. Is there a way to mark and neglect all the existing legacy issues ?


Solution

  • Yes, you can exclude those files from scan.

    From project settings you can exclude, you can choose to exclude only for issues or you can totally exclude the file (no metrics is generated - loc, complexity, duplication nothing is calculated)

    If first analysis has not happened use provisioning to achieve the same.

    Updating to cover peculiar case of excluding only old issues: By marking all old issues as false positives you'd exclude them from future analysis, though might sound like bonkers it will work as long as don't change directory structure.