I’m migrating from SonarSource/sonarcloud-github-c-cpp to onarSource/sonarqube-scan-action/install-build-wrapper and SonarSource/sonarqube-scan-action. I’m hitting this error:
Caused by: java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: /runner/_work/packdb/packdb/contrib/aws-c-common/tests/resources/?? ??xample.txt
at java.base/sun.nio.fs.UnixPath.encode(Unknown Source)
at java.base/sun.nio.fs.UnixPath.<init>(Unknown Source)
at java.base/sun.nio.fs.UnixFileSystem.getPath(Unknown Source)
at java.base/java.io.File.toPath(Unknown Source)
at org.sonar.plugins.javascript.analysis.TsConfigProvider$LookupTsConfigProvider.tsconfigs(TsConfigProvider.java:236)
at org.sonar.plugins.javascript.analysis.TsConfigProvider.tsconfigs(TsConfigProvider.java:125)
at org.sonar.plugins.javascript.analysis.TsConfigProvider.getTsConfigs(TsConfigProvider.java:99)
at org.sonar.plugins.javascript.analysis.AnalysisWithProgram.analyzeFiles(AnalysisWithProgram.java:52)
at org.sonar.plugins.javascript.analysis.JsTsSensor.analyzeFiles(JsTsSensor.java:82)
at org.sonar.plugins.javascript.analysis.AbstractBridgeSensor.execute(AbstractBridgeSensor.java:71)
... 22 common frames omitted
14:45:08.620 INFO EXECUTION FAILURE
14:45:08.621 INFO Total time: 58.621s
I tried to add sonar.sourceEncoding=UTF-8 to sonar-project.properties.
questions
How can I fix it?
Is there any recommendation to exclude contrib directories (with lots of git submodules) from the sonar scanner? What’s the sonar team recommendation for it?
After excluding contrib/** in sonar-project.proterties file (sonar.exclusions) it worked. But I’m not sure if this a good solution. Should sonar scan vendors directories like contrib and others?
thanks for reporting this. I agree with @Colin that it makes sense to add contrib to the default exclusions. I created a ticket to handle this.
In any case, not directly related but another possible workaround is to skip altogether the tsconfig.json files lookup (the failure happens while traversing the project tree looking for those files) by providing the property: