Code does not show up on short-lived branches

  • ALM used: Azure DevOps

  • CI system used: Azure DevOps

  • Scanner command used when applicable (private details masked):

    • task: SonarCloudPrepare@1
      SonarCloud: ‘SonarCloud’
      organization: ‘redacted’
      scannerMode: ‘CLI’
      configMode: ‘manual’
      cliProjectKey: ‘redacted’
      cliProjectName: ‘redacted’
      cliSources: ‘.\redactedCommon,redactedWeb’
      extraProperties: |\redactedCommon\source\com\redacted\redacted*\redactedCommon\lib*.jar
  • Languages of the repository: Java

  • Error observed: No error. The scan actually runs successfully for the non-master (feature) branches. When I go to the Code tab to look at the code scanned it shows nothing. If I merge that same commit into master it the code shows up in the master branch scan.

Hey there.

Let me suggest you pass sonar.verbose=true and check the logs on such a pull request build (where no files are showing as changed). You are looking for logs starting around here:

07:27:39.608 INFO: SCM collecting changed files in the branch

Out of curiousity, what kind of files are these? Java files? another language? Source files? Test files?

There is a lot of stuff that has is “excluded by the scm ignore settings.” I dont have any scm ignore settings configured that I know of unless that means the .gitignore file? Other than that I don’t know what to look for.

It’s all Java. For the java.binaries I gave it the folder with all of the .class files for the libraries I gave it the area where the third party libraries are (.jar). The identified source folders contain .java files and some .jsp.