Pull Request Analysis reporting 0 new lines "was detected as changed but without having changed"

  • ALM used: Bitbucket Cloud
  • CI system used: Bitbucket Cloud

I am building a custom docker image to be used on Bitbucket pipelines and I am testing it locally first.

As we have some complications with our repository, we are running the sonnar scanner mannualy.

I am using version:

INFO: SonarScanner 5.0.1.3006
INFO: Java 17.0.7 Eclipse Adoptium (64-bit)

I have a pull request from branch feature/APED-8286 to merge it in dev-23.05 and the bitbucket pull request key is 2666.

Relevant lines of the sonar-project.properties file:

sonar.pullrequest.key=2666
sonar.pullrequest.branch=feature/APED-8286
sonar.pullrequest.base=dev-23.05

These configurations seems to be OK as the log states:

INFO: Pull request 2666 for merge into dev-23.05 from feature/APED-8286

The branch dev-23.05 is fetched locally and I am running the analysis on the feature branch:
image

Running

git diff --name-only dev-23.05...HEAD

I can se the 14 files that were changed:

image

On the log, these same 14 files are reported as “was detected as changed but without having changed lines”:

WARN: File '/home/qa/edeploy-pos-structure/src/edpscripts/src/application/domain/__init__.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpscripts/src/application/repository/_PosCtrlRepository.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpbohpump/src/application/repository/_MessageBusRepository.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpscripts/src/actions/functions/do_transfer.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpscripts/src/poslistener.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpscripts/src/application/domain/_OperatorSession.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpbohpump/src/application/model/exceptions/__init__.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpbohpump/src/application/interactor/_OperatorLogoutInteractor.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpscripts/src/actions/util/get_payments_amount_by_type.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpbohpump/src/application/model/exceptions/_MissingOperatorInfo.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpscripts/src/application/repository/__init__.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpbohpump/src/eventhandlerbuilder/_AuditEventConsumerEventHandler.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpscripts/src/application/interactor/_MissingLogoutInfoInteractor.py' was detected as changed but without having changed lines
WARN: File '/home/qa/edeploy-pos-structure/src/edpscripts/src/application/interactor/__init__.py' was detected as changed but without having changed lines

Other warning and erros on the log doesn´t seem to help:

WARN: Invalid character encountered in file /home/qa/edeploy-pos-structure/src/gui/nti/src/pages/06-payment/06.09-OrderFinalized.jsx at line 46 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.

WARN: No explicit support for version 2.7. Support for Python versions prior to 3 is deprecated.

WARN: No report was found for sonar.python.coverage.reportPaths using pattern ./_test/python_coverage.xml

ERROR: Failed to parse file [gui/sui/src/constants/Images.js] at line 1: Declaration or statement expected.
ERROR: Failed to parse file [gui/kui/src/actions/index.js] at line 1: Declaration or statement expected.
INFO: 673/1064 files analyzed, current file: /home/qa/edeploy-pos-structure/src/gui/sui/src/app/component/footer/index.js
ERROR: Failed to parse file [gui/3s-posui/src/actions/index.js] at line 1: Declaration or statement expected.

In case someone runs into the same issue the problem is related to the repository being a submodule of a parent repository.
I don´t know if this is a bug or a limitation.
I changed my pipeline to clone the submodule directly and it worked as expected.

I don’t know either. I know some work was done in SonarQube to better support submodules and I’m not sure if it was meant to fix the issue you run into, or if that work was ever put into SonarCloud. I’ll flag this for some experts. Thanks for the report and follow-up!