Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
- how is SonarQube deployed: zip, Docker, Helm
- what are you trying to achieve
- what have you tried so far to achieve this
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) - It’s the SQ task on Azure DevOps
- how is SonarQube deployed: zip, Docker, Helm - Docker
- what are you trying to achieve - There is an error when scanning YAML files.
- what have you tried so far to achieve this - Excluded YAML from scanning
We are using SQ with Azure DevOps and we’re scanning a repo that is not a project repo as such, it has a bunch of Py, Shell and PS1 scripts, and a bunch of YAML for K8S deployments. The issue is that SQ scans everything else but cannot the YAML files. This is what’s thrown:
##[error]java.lang.UnsupportedOperationException: Can not add the same measure twice on Metrics/****db-storage.yaml: DefaultMeasure[component=Metrics/****db-storage.yaml,metric=Metric[uuid=<null>,key=ncloc_data,description=<null>,type=DATA,direction=0,domain=<null>,name=ncloc_data,qualitative=false,userManaged=false,enabled=true,worstValue=<null>,bestValue=<null>,optimizedBestValue=false,hidden=false,deleteHistoricalData=false,decimalScale=<null>],value=1=1;2=1;3=1;4=1;5=1;6=1;7=1;8=1;9=1;10=1;11=1,fromCore=false,storage=org.sonar.scanner.sensor.DefaultSensorStorage@2f59f157,saved=false]
The only way to get around this is by excluding YAML (in extraProperties in Prepare task), like this: sonar.exclusions=**/*.xml,**/*.csv,**/*.css,**/*.png,**/*.yaml
But I noticed despite this, in the report sent to SQ Portal, under Issues → Languages, I see Python, Shell and also YAML. Why is this?