Code files are not visible in project branch view but 1806 files were indexed

Background
server: Developer Edition - Version 9.9.3 (build 79811), hosted in aws EC2 docker container
scanner: github actions: sonarsource/sonarqube-scan-action@master (SHA:1b9d398800bf807ad36901b351fff52deba642d6)
*
I’ve noticed that the code section of my project in the sonarqube frontend does not show any indexed code files. Instead it says “No code files were found for analysis.” However, the logs say that 1806 files were indexed. This prevents me from viewing any code smells, security vulnerabilities, or other metrics.

Scanner parameters are set in sonar-project.properties as follows:

sonar.projectKey=project
sonar.host.url=https://test.vendor.se
sonar.sources=./src
sonar.javascript.lcov.reportPaths=./lcov.info
sonar.eslint.reportPaths=./eslint-report.json
sonar.javascript.node.maxspace=4096

Attached is a debug log from the scanner.
sonar.log (1.9 MB)

Here are also some screenshots of the project view:


Help for finding a way to have the indexed files be displayed in the project view would be appreciated.

I think I’ve found a bug in the sonarqube-scan-action. Setting the fetch-depth to 0 for the job that runs the scanner causes the report to exclude all of the indexed files. Not setting fetch-depth produces the desired results.

Hey there.

That’s weird! Setting fetch-depth: 0 is the same as disabling shallow clones, which the scanner needs for an accurate analysis.

Can you try setting fetch-depth: 0 again, but also setting sonar.scm.exclusions.disabled=true and see if the files are analyzed?

Hi Colin. I tried your suggestion and it produces the same results: Files are indexed but the report shows none of the indexed files.

Hey there.

Coming back to your logs, I realized you’re actually performing a pull request analysis!

2023-12-27T09:43:58.8212579Z 09:43:58.820 INFO: ANALYSIS SUCCESSFUL, you can find the results at: https://test.vendor.se/dashboard?id=project&pullRequest=1

The whole point of a Pull Request analysis is that you only see changed lines, and when you perform a shallow clone you can’t accurately determine what lines changed, thus you get more results. But the results are not relevant in the context of a pull request.

I suggest you turn off shallow clones again (fetch depth: 0) and try analyzing your main branch.

Hi Colin. This is the correct solution. Thank you.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.