Hello,
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.
Context:
- GitHub Repository
- Language: Apex
- External Scanner: PMD
- Config
GitHub Workflow snippet:
- uses: actions/checkout@v2
with:
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 "https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.47.0/pmd-bin-6.47.0.zip" -o pmd-bin-6.47.0.zip
unzip pmd-bin-6.47.0.zip
rm pmd-bin-6.47.0.zip
- name: Run static analysis
run: pmd-bin-6.47.0/bin/run.sh 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
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
SONAR_TOKEN: "${{ secrets.SONAR_TOKEN }}"
with:
args: >
-Dsonar.apex.pmd.reportPaths=pmd.xml
-Dsonar.test.exclusions=**/*
-Dsonar.coverage.exclusions=**/*
-Dsonar.cpd.exclusions=**/*
sonar-project.properties
# sonar-project.properties
sonar.projectKey=XXXXXX
sonar.organization=XXXXXX
# sonar.sources property to limit the scope of the analysis to certain directories.
sonar.sources=./src
sonar.language=apex
sonar.sourceEncoding=UTF-8