I am posting an update on what we have done so far and our findings. In the hope that someone from Sonarsouce will be able to use this information.
Azure DevOps Repos
Using Azure DevOps yml pipelines.
Task name for this case is the Maven@4
Pipeline: All of the necessary taks to get ready for the build then we do SonarCloudPrepare@4 → Maven@4 (goals: ‘clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:5.7.0.6970:sonar’)
options: >
-DskipTests=true
-Denv=${{ lower(parameters.muleEnvironment) }}
-Dmule.env=${{ lower(parameters.muleEnvironment) }} ${{ parameters.munitSAPConnectorProfile }} $(azureVaultSecretsforMunits)
-Dsonar.sources=src/main
-Dsonar.tests=src/test/munit
-Dsonar.inclusions=\*\*/\*.xml,\*\*/\*.dwl
-Dsonar.verbose=true
-Dsonar.projectKey=<orgName>\_ foo_bar
-> SonarCloudPublish@4
Project Structure
Dataweave files located under
src/main/resources/mappings/*.dwl
Example files
create-enquiry-request.dwl
ErrorHandlerUtils.dwl
set-workflow-headers.dwl
…
Sonar Scanner Configuration
-Dsonar.sources=src/main
-Dsonar.tests=src/test/munit
-Dsonar.inclusions=**/*.xml,**/*.dwl
-Dsonar.verbose=true
Scanner Context confirms
sonar.sources=/home/vsts/work/1/s/src/main
sonar.tests=/home/vsts/work/1/s/src/test/munit
sonar.dataweave.file.suffixes=dwl
No project level inclusions or exclusions are configured in SonarQube/Cloud
Successful Analysis
Verbose logging shows
Quality profile for dataweave: DataWeave
Sensor Deterministic Rule Engine for DataWeave [dre]
Starting analysis of 9 files with 25 rules
Sensor Deterministic Rule Engine for DataWeave [dre] (done)
Mule analysis is running
Sensor Deterministic Rule Engine for Mule [dre]
Starting analysis of 6 files with 41 rules
And XML analysis
Sensor XML Sensor [xml]
7 source files to be analyzed
7/7 source files have been analyzed
The scan completes successfully
ANALYSIS SUCCESSFUL
Questions we have
Although the logs clearly show the analysis was successful. The Sonarqube/Cloud UI for the project. Show it as passed, but no details or any information. Code → results are empty, Measures show nothing. Cannot browse to any files through the code view. Is this expected behaviour for the Mule/DataWeave DRE analyzers in SonarQube/Cloud ? or should we see something. Based on the logs, the analyzers appear to be functioning correctly. We’re now trying to understand whether the UI behaviour is expected or indicative of another issue. Also why in the Quality Profiles can you not Add MuleSoft as a language as it does not appear in the list), teams want to see what rules are being applied, as the logs clearly say
INFO] Sensor Deterministic Rule Engine for Mule [dre]
INFO] Detected mule-artifact.json.
INFO] Starting analysis of 6 files with 41 rules
Where are these rules coming from ?