Why sonar scanner scaned 0 file when using pull request analysis sometimes?

Hi,
My company is using SonarQube of Enterprise Edition Version 7.9.1 (build 27448).
For some PR branch, when using pull request analysis, sonar scanner will scan 0 file. :frowning_face:

here is the 0 scanned log:
I just added a .gitignor with content:

image

[2020-04-20T05:24:00.946Z] INFO: Load project settings for component key: ‘cas-system-python-lib’

[2020-04-20T05:24:01.201Z] INFO: Load project settings for component key: ‘cas-system-python-lib’ (done) | time=147ms

[2020-04-20T05:24:01.201Z] INFO: Load project branches

[2020-04-20T05:24:01.456Z] INFO: Load project branches (done) | time=153ms

[2020-04-20T05:24:01.456Z] INFO: Load project pull requests

[2020-04-20T05:24:01.712Z] INFO: Load project pull requests (done) | time=149ms

[2020-04-20T05:24:01.712Z] INFO: Load branch configuration

[2020-04-20T05:24:01.712Z] INFO: Load branch configuration (done) | time=9ms

[2020-04-20T05:24:01.712Z] INFO: Load quality profiles

[2020-04-20T05:24:01.973Z] INFO: Load quality profiles (done) | time=219ms

[2020-04-20T05:24:01.973Z] INFO: Detected Jenkins

[2020-04-20T05:24:01.973Z] INFO: Load active rules

[2020-04-20T05:24:08.503Z] INFO: Load active rules (done) | time=6590ms

[2020-04-20T05:24:08.503Z] INFO: Pull request 100 for merge into master from feature/CAS-32942

[2020-04-20T05:24:08.503Z] INFO: SCM collecting changed files in the branch

[2020-04-20T05:24:08.760Z] INFO: SCM collecting changed files in the branch (done) | time=185ms

[2020-04-20T05:24:09.017Z] INFO: Indexing files…

[2020-04-20T05:24:09.017Z] INFO: Project configuration:

[2020-04-20T05:24:09.017Z] INFO: Excluded sources for coverage: /tests/, **/setup.py, **/init.py, **/README.md

[2020-04-20T05:24:09.277Z] INFO: 0 files indexed

[2020-04-20T05:24:09.277Z] INFO: 0 files ignored because of scm ignore settings

[2020-04-20T05:24:09.277Z] INFO: ------------- Run sensors on module cas-system-python-lib

[2020-04-20T05:24:09.839Z] INFO: Load metrics repository

[2020-04-20T05:24:09.839Z] INFO: Load metrics repository (done) | time=146ms

[2020-04-20T05:24:11.204Z] INFO: Load server rules

[2020-04-20T05:24:12.570Z] INFO: Load server rules (done) | time=1094ms

[2020-04-20T05:24:15.089Z] INFO: Sensor Embedded CSS Analyzer Sensor [css]

[2020-04-20T05:24:15.345Z] INFO: 0 source files to be analyzed

[2020-04-20T05:24:15.345Z] INFO: 0/0 source files have been analyzed

[2020-04-20T05:24:15.345Z] INFO: Sensor Embedded CSS Analyzer Sensor [css] (done) | time=182ms

[2020-04-20T05:24:15.345Z] INFO: Sensor JavaXmlSensor [java]

[2020-04-20T05:24:15.345Z] INFO: Sensor JavaXmlSensor [java] (done) | time=1ms

[2020-04-20T05:24:15.345Z] INFO: Sensor OWASP Zap-Check [zap]

[2020-04-20T05:24:15.345Z] INFO: Process ZAP report

[2020-04-20T05:24:15.345Z] WARN: ZAP report does not exist.

[2020-04-20T05:24:15.345Z] INFO: Process ZAP report (done) | time=0ms

[2020-04-20T05:24:15.345Z] INFO: Sensor OWASP Zap-Check [zap] (done) | time=1ms

[2020-04-20T05:24:15.345Z] INFO: Sensor JaCoCo XML Report Importer [jacoco]

[2020-04-20T05:24:15.345Z] INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms

[2020-04-20T05:24:15.345Z] INFO: Sensor JavaSecuritySensor [security]

here is the normal log

[2020-04-15T16:12:56.756Z] INFO: Load project settings for component key: ‘cas-system-python-lib’

[2020-04-15T16:12:56.756Z] INFO: Load project settings for component key: ‘cas-system-python-lib’ (done) | time=149ms

[2020-04-15T16:12:56.756Z] INFO: Load project branches

[2020-04-15T16:12:57.012Z] INFO: Load project branches (done) | time=148ms

[2020-04-15T16:12:57.012Z] INFO: Load project pull requests

[2020-04-15T16:12:57.012Z] INFO: Load project pull requests (done) | time=144ms

[2020-04-15T16:12:57.012Z] INFO: Load branch configuration

[2020-04-15T16:12:57.012Z] INFO: Load branch configuration (done) | time=2ms

[2020-04-15T16:12:57.012Z] INFO: Load quality profiles

[2020-04-15T16:12:57.269Z] INFO: Load quality profiles (done) | time=186ms

[2020-04-15T16:12:57.269Z] INFO: Detected Jenkins

[2020-04-15T16:12:57.269Z] INFO: Load active rules

[2020-04-15T16:13:03.805Z] INFO: Load active rules (done) | time=6590ms

[2020-04-15T16:13:04.060Z] INFO: Pull request 99 for merge into master from feature/CAS-32798

[2020-04-15T16:13:04.060Z] INFO: SCM collecting changed files in the branch

[2020-04-15T16:13:04.060Z] INFO: SCM collecting changed files in the branch (done) | time=113ms

[2020-04-15T16:13:04.316Z] INFO: Indexing files…

[2020-04-15T16:13:04.316Z] INFO: Project configuration:

[2020-04-15T16:13:04.316Z] INFO: Excluded sources for coverage: /tests/, **/setup.py, **/init.py, **/README.md

[2020-04-15T16:13:04.573Z] INFO: 127 files indexed

[2020-04-15T16:13:04.573Z] INFO: 0 files ignored because of scm ignore settings

[2020-04-15T16:13:04.573Z] INFO: Quality profile for py: Sonar way

[2020-04-15T16:13:04.573Z] INFO: Quality profile for xml: Sonar way

[2020-04-15T16:13:04.573Z] INFO: Quality profile for yaml: Sonar way

[2020-04-15T16:13:04.573Z] INFO: ------------- Run sensors on module cas-system-python-lib

[2020-04-15T16:13:04.573Z] INFO: Load metrics repository

[2020-04-15T16:13:04.831Z] INFO: Load metrics repository (done) | time=176ms

[2020-04-15T16:13:05.760Z] INFO: Load server rules

[2020-04-15T16:13:07.129Z] INFO: Load server rules (done) | time=1270ms

[2020-04-15T16:13:09.021Z] INFO: Sensor Embedded CSS Analyzer Sensor [css]

[2020-04-15T16:13:09.021Z] INFO: 0 source files to be analyzed

[2020-04-15T16:13:09.021Z] INFO: Sensor Embedded CSS Analyzer Sensor [css] (done) | time=64ms

[2020-04-15T16:13:09.021Z] INFO: 0/0 source files have been analyzed

[2020-04-15T16:13:09.021Z] INFO: Sensor JavaXmlSensor [java]

[2020-04-15T16:13:09.021Z] INFO: 3 source files to be analyzed

[2020-04-15T16:13:09.276Z] INFO: 3/3 source files have been analyzed

[2020-04-15T16:13:09.276Z] INFO: Sensor JavaXmlSensor [java] (done) | time=253ms

[2020-04-15T16:13:09.276Z] INFO: Sensor XML Sensor [xml]

[2020-04-15T16:13:09.276Z] INFO: 3 source files to be analyzed

[2020-04-15T16:13:09.533Z] WARN: Unable to analyse file file:///var/lib/jenkins/workspace/cas-system-python-lib_PR-99/pylint-report.xml;

[2020-04-15T16:13:09.533Z] INFO: 3/3 source files have been analyzed

Thanks/Sai

Thanks/Sai

Hello Sai,

A PR analysis focuses on code that changed in a given branch/PR, you can see below steps in the log:

[2020-04-15T16:13:04.060Z] INFO: SCM collecting changed files in the branch
[2020-04-15T16:13:04.060Z] INFO: SCM collecting changed files in the branch (done) | time=113ms

At INFO level the log does not actually say how many files changed (and if that was 0) - however if you bump it up to DEBUG level output should carry more details on this.

Hope that helps.
Kris