I have a repo in azure DevOps with only folder as test. Now, I have given the task structure in this way in azure DevOps. But I cannot see the code getting analyzed in sonarqube. The code tab shows blank. Could someone help me with where I am going wrong?? I do not want to give folder name in sources..I want whatever code I add in the branch to be analyzed.
edit: Just realized this is happening only for feature short lived branch..My sonarqube version is 8.0
steps:
- task: SonarQubePrepare@4 inputs: SonarQube: 'connection name' scannerMode: 'CLI' configMode: 'manual' cliProjectKey: 'pipeline-sonar-demo' cliProjectName: 'pipeline-sonar-demo' cliSources: "." extraProperties: | # Additional properties that will be passed to the scanner, # Put one key=value per line, example: sonar.exclusions=**/*.xml
SonarQube extension provides three tasks you will use in your build definitions to analyze your projects:
Prepare Analysis Configuration task, to configure all the required settings before executing the build.
Run Code Analysis task, to actually execute the analysis of the source code.
scanner will be run as part of the Maven/Gradle build.
Publish Quality Gate Result task, to display the Quality Gate status in the build summary and give you a sense of whether the application is ready for production "quality-wise".
It seems you still need add Run Code Analysis task. Regarding how to use SonarScanner for Azure DevOps, please refer to the following documentation:
https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-azure-devops/