Threat old code as new code

My team choosed to fix old code issues as we code (and only on modified files) but SonarCloud is only reporting issues on new Code.
I tried setting the “New Code” config as “Specific date” to a date older than the creation of the repository (01/01/2012), but the old issues are still not reported.


  • GitHub Repository
  • Language: Apex
  • External Scanner: PMD
  • Config
    GitHub Workflow snippet:
      - uses: actions/checkout@v2
          fetch-depth: 0
      - name: Generate diff file
        run: |
          git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} > diff.txt
      - name: Install PMD
        run: |
          curl -L "" -o
      - name: Run static analysis
        run: pmd-bin-6.47.0/bin/ pmd --rulesets pmd/ruleset-all.xml --file-list diff.txt --format xml --report-file pmd.xml --short-names --fail-on-violation false
      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
          GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
          SONAR_TOKEN: "${{ secrets.SONAR_TOKEN }}"
          args: >


# sonar.sources property to limit the scope of the analysis to certain directories.


Hey there.

In the context of a Pull Request / short-lived branch Analysis – you will only ever see issues on changed lines of changed files, no matter how you adjust the New Code Period.

On your main branch (and long-lived branches), however, you should see all issues reported (and on the dashboard of the branch, the results split into New Code and Overall Code

Would it then work if i set all branches as long-lived branches ? and why does SonarCloud impose a Code Quality strategy instead of leaving it up to the users to set their own ?

A Clean as You Code strategy would definitely work for new projects but not for older ones were teams are trying to fix existing issues and vulnerabilities

Hello again @Colin, just found out i’m not the only one wanting this feature

It’s insane how a feature so wanted by users since 2019 is still not available, can you please lead me to any possible workaround?