Eslint paths in SonarCloudPrepare@1 not found

Hi, I have the following block running in a pipeline.

steps:
  - task: SonarCloudPrepare@1
    displayName: 'Prepare analysis configuration'
    inputs:
      SonarCloud: '***_admin'
      organization: '***'
      scannerMode: 'CLI'
      configMode: 'manual'
      cliProjectKey: ${{ parameters.projectKey }}
      cliProjectName: ${{ parameters.projectName }}
      cliSources: ${{ parameters.sources }}
      extraProperties: |
        sonar.javascript.lcov.reportPaths=$(Pipeline.Workspace)/reports/lcov.info
        sonar.eslint.reportPaths=$(Pipeline.Workspace)/reports/eslint-result.json

In a previous stage is where the reports get generated. So when this stage and steps run, ESLint displays the following: No ESLint issues will be imported on this file. I know this is because the paths from the prior stage are different than the paths in the Sonar stage. The reports all have /home/vsts/work/1/s/src. and when the Sonar stage runs the project is installed in /a/1/s/src/

I tried various things, such as running a sed cmd in the above steps to change the path, but I still get errors. Any suggestions?

Hi,

Welcome to the community!

You’ve correctly identified the problem: the paths analysis sees don’t match the paths in the reports.

And I think you’re on the right track for the fix: editing the report. This should be as “simple” as making the paths relative to the directory where analysis is kicked off from.

Maybe that helps?

 
Ann