System informations :
SonarQube version : 184.108.40.206781
SonarScanner version : 220.127.116.112
java : Java 1.8.0_121
I wanted to know if sonar scanner was doing something special regarding the scope of file to scan when considering pull requests. And if so under which condition. I’ll give you the context that motivates my question.
I do have a java project. When i launch a scan on a branch i do not have the same number of files that will be analyzed in regards to a pull requests that targets that same branch. Example :
- seen in the branch scan log :
INFO: 6705 files indexed INFO: 24361 files ignored because of inclusion/exclusion patterns INFO: [....] INFO: Java Main Files AST scan INFO: 3755 source files to be analyzed
- seen in the PR scan log :
INFO: 6695 files indexed INFO: 24585 files ignored because of inclusion/exclusion patterns INFO: [....] INFO: Java Main Files AST scan INFO: 468 source files to be analyzed
I tried to understand what would cause such difference:
- I guessed that it might be because sonar scanner was relying on the changed file list, but the number of souce files to be analyzed does not match the number of modified files.
- I assumed then that it would be the result of the Abstract Syntaxt Tree representation of the modified files that would provoke the inclusion of some additionnal files in the scope of analysis. But i could not verify that assumption.
So why do i have a difference between the PR and Branch analysis. And in the case of the PR what is deciding of the scope of file to analyze.
Secondly, i have a python project that relies only on pylint rules. In that case i have no difference in scanning scope as the full source folder is scanned whether it is a branch or a PR. I do find that behavior more logical that the one seen with the java project. So why do i have a difference between the two project ? Does it comes with the fact that java does have a better scanner ?