Invalid directory path in 'source' element

Template for a good new topic, formatted with Markdown:

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Scanner command used when applicable (private details masked)
  • Languages of the repository: Python 3.12
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
11:44:33.680 INFO: Parsing report '/home/vsts/work/1/s/coverage_platform.xml'
11:44:33.727 WARN: Invalid directory path in 'source' element: /physicalTradingPlatform
##[error]11:44:33.728 ERROR: Cannot resolve the file path 'manage.py' of the coverage report, the file does not exist in all 'source'.
11:44:33.728 ERROR: Cannot resolve the file path 'manage.py' of the coverage report, the file does not exist in all 'source'.
##[error]11:44:33.739 ERROR: Cannot resolve 17 file paths, ignoring coverage measures for those files
11:44:33.739 ERROR: Cannot resolve 17 file paths, ignoring coverage measures for those files
11:44:33.740 INFO: Parsing report '/home/vsts/work/1/s/coverage-platform.xml'
11:44:33.740 WARN: Invalid directory path in 'source' element: /physicalTradingPlatform
##[error]11:44:33.740 ERROR: Cannot resolve the file path 'manage.py' of the coverage report, the file does not exist in all 'source'.
11:44:33.740 ERROR: Cannot resolve the file path 'manage.py' of the coverage report, the file does not exist in all 'source'.
##[error]11:44:33.749 ERROR: Cannot resolve 43 file paths, ignoring coverage measures for those files
11:44:33.749 ERROR: Cannot resolve 43 file paths, ignoring coverage measures for those files
11:44:33.749 INFO: Parsing report '/home/vsts/work/1/s/coverage-etl.xml'
11:44:33.749 WARN: Invalid directory path in 'source' element: /etl
##[error]11:44:33.749 ERROR: Cannot resolve the file path 'src/__init__.py' of the coverage report, the file does not exist in all 'source'.
11:44:33.749 ERROR: Cannot resolve the file path 'src/__init__.py' of the coverage report, the file does not exist in all 'source'.
##[error]11:44:33.750 ERROR: Cannot resolve 5 file paths, ignoring coverage measures for those files
11:44:33.750 ERROR: Cannot resolve 5 file paths, ignoring coverage measures for those files
11:44:33.750 INFO: Parsing report '/home/vsts/work/1/s/coverage_etl.xml'
11:44:33.758 WARN: Invalid directory path in 'source' element: /etl
##[error]11:44:33.758 ERROR: Cannot resolve the file path 'src/nomination/utils/EMS_data_ingestor.py' of the coverage report, the file does not exist in all 'source'.
11:44:33.758 ERROR: Cannot resolve the file path 'src/nomination/utils/EMS_data_ingestor.py' of the coverage report, the file does not exist in all 'source'.
11:44:33.758 INFO: Sensor Cobertura Sensor for Python coverage [python] (done) | time=128ms
  • Steps to reproduce
    Have two (or more coverage report) with element defined as a folder in working directory
    Define the folders as sonar.source
    run Azure task SonarCloudAnalyze@1

  • Potential workaround:
    Unknown
    invalid_source.zip (7.0 KB)

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

SonarCloud reports folder physicalTradingPlatform and etl as invalid, even thou they exist in the working directory

EDIT: Having element has either /etl or etl both produces the error

12:00:18.404 WARN: Invalid directory path in 'source' element: /etl

So I got a bit fooled by the sonar-project.properties

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
sonar.sources=./

Turns out it is not relative at all and what SonarCloud expects is

<source>$(Build.SourcesDirectory)/etl</source>

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