Azure Pull Request Comments

I just started working with SonarCloud and trying to get pull request comments working.

We build all our projects in docker containers (due to platform dependencies) so we have to use the scanner.

The scanner works great but we are having pathing issues for the comments that get added to our pull request. Our solution and code live in a src directory. But when the comments get posted, it strips off the src so the comment isn’t added to the file/line correctly.

I had this working and started making adjustments to include code coverage information and I broke it.

I tried running the scanner in the root of the project… and in the src folder. nothing seems to solve my issue.

I also tried to provide a sources argument to the scanner but that just causes the scanner to crash because its duplicating the scans.

File .cs can’t be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files

What am I missing here?

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
    Azure DevOps
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI
    Azure DevOps
  • Scanner command used when applicable (private details masked)
    dotnet sonarscanner begin
    /k:"$(sonarCloudProject)"
    /o:“marconet”
    /d:sonar.host.url=“https://sonarcloud.io
    /d:sonar.login="$(SONARCLOUDLOGINKEY)"
    /d:sonar.scm.provider=git
    /d:sonar.pullrequest.provider=vsts
    /d:sonar.pullrequest.key=$(System.PullRequest.PullRequestId)
    /d:sonar.pullrequest.base=$(System.PullRequest.TargetBranch)
    /d:sonar.pullrequest.branch=$(System.PullRequest.SourceBranch)
    /d:sonar.pullrequest.vsts.instanceUrl=$(System.CollectionUri)
    /d:sonar.pullrequest.vsts.project="$(System.TeamProject)"
    /d:sonar.pullrequest.vsts.repository="$(Build.Repository.Name)"
  • Languages of the repository
    ASP .Net Core C#/Javascript

Hello @jthunt and welcome to the community!

Please give us the following version information:

Additionally, could you please give us the verbose output of the scanner commands (please run the scanner begin step with the /d:sonar.verbose=true parameter, and please attach the output of the BEGIN and END steps)

Thank you,
Costin

Thanks for the reply… I finally found the issue.

Apparently I ran a scan in the wrong directory once and the results got submitted to SonarCloud. From that point forward, the directory structure wasn’t right.

After resetting the project in SonarCloud, comments are showing up correctly on my pull requests in Azure DevOps.

1 Like

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