I have a few file/folder names which are not UTF-8 in my project. I have added the pattern of these files into the ‘sonar.exclusions’ property and, since these are .py files and all we want to analysis are .cpp/.c/.h/.hpp files, I have also placed these correct extensions into the file ‘sonar.includes’ property. However, sonar scanner still throws an error. I guess the file names are first being obtained and only after the matching patterns are discarded.
Using SonarScanner version 4.7.0.2747
Trying to upload findings to SonarQube using Sonar Scanner
Is there any way of avoiding this behavior? I am currently blocked because the file renaming cannot be done, so I think it should be possible to simply ignore all folders with a certain pattern for this not to happen
Thank you! Sorry for the late reply, but I have been on vacation.
I can’t show the entire error, because I have some sensitive information. But the traceback is something like this:
15:53:38.930 INFO: ------------------------------------------------------------------------
15:53:38.931 INFO: EXECUTION FAILURE
15:53:38.931 INFO: ------------------------------------------------------------------------
15:53:38.931 INFO: Total time: 14.619s
15:53:39.020 INFO: Final Memory: 8M/68M
15:53:39.020 INFO: ------------------------------------------------------------------------
15:53:39.020 ERROR: Error during SonarScanner execution
java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters:
Then it outputs a python file that has a zero width space. The issue is my sonar.properties file looks like this:
# Path is relative to the sonar-project.properties file. Defaults to .
sonar.sources=.
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
# Narrowing down to files of interest
# https://sonarqube.cc.bmwgroup.net/documentation/project-administration/narrowing-the-focus/
sonar.inclusions=**/*.cpp, **/*.c, **/*.cc, **/*.h, **/*.hpp
sonar.exclusions=**/*.js,**/*.css
I even added python files to sonar.exclusions property, but it gives the same error.
Any help is appreciated!