Sonar scan does not exclude the sources though its mentioned in sources exclusion

  • Versions used SonarQube: 9.3 Scanner : 4.7.0.2747

We have some files/dirs QOUTA/TestScripts in sources which we are trying to exclude everything from this directory while executing scan, same is mentioned in properties file with sonar.exclusions.
Though in the logs scanner prints that its ignoring those, but in reality it does not and fails during the scan.

We have configured this as per docs Narrowing the Focus | SonarQube Docs ,
So why is it not excluding everything from this directory QOUTA/TestScripts/**/* ?

INFO: Project configuration:
INFO:   Excluded sources: misc/**/*, Tools/**/*, CI/**/*, ci-cd/**/*, QOUTA/TestScripts/**/*
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 7.556s
INFO: Final Memory: 21M/100M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: QOUTA/TestScripts/Server/test_certs/aTest??z_??_S.A..pem
  	at java.base/sun.nio.fs.UnixPath.encode(UnixPath.java:145)
  	at java.base/sun.nio.fs.UnixPath.<init>(UnixPath.java:69)
  	at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:279)
  	at java.base/java.nio.file.Path.resolve(Path.java:515)
  	at org.sonar.scm.git.IncludedFilesRepository.indexFiles(IncludedFilesRepository.java:65)
  	at org.sonar.scm.git.IncludedFilesRepository.<init>(IncludedFilesRepository.java:40)
  	at org.sonar.scm.git.GitIgnoreCommand.init(GitIgnoreCommand.java:37)
  	at org.sonar.scanner.scan.filesystem.ProjectFileIndexer.index(ProjectFileIndexer.java:104)```

Hi,

Could we have the full analysis log, including the full stacktrace?

I think the files are excluded from analysis. The error seems to be coming from the SCM sensor, which is trying to collect data about the files, rather than analyzing what’s in the files. (Okay, I get it if that’s a distinction without a difference for you.) The problem seems to be the file name. Would you mind sharing the name as well?

 
Thx,
Ann

Hi @ganncamp ,
Yes, my understanding was exclude means, exclude from every where not just analysis.
Attached is the full log and I agree file name is
little weird AC_Raíz_Certicámara_S.A..pem

scanner.log (5.5 KB)

Thanks.

Hi,

Thanks for the full analysis log, and for the full file name.

As you were already quite aware, this looks like a bug. :smiley:

I know that validation doesn’t help you get analysis accomplished, though. Can you try explicitly excluding **/*.pem files? (And let us know if that works?)

Meanwhile, I’m going to refer this to the team to get attention on this bug handling non-UTF-8 characters in file names.

 
Ann

Hi @ganncamp ,
Thanks. Excluding **/*.pem did not help either it fails with same.

Excluded sources: misc/**/*, Tools/**/*, CI/**/*, ci-cd/**/*, **/test/*, QUOTA/TestScripts/**/*, **/*.pem

ERROR: Error during SonarScanner execution java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: QUOTA/TestScripts/Server/test_certs/AC_Ra??z_Certic??mara_S.A..pem at java.base/sun.nio.fs.UnixPath.encode(UnixPath.java:145)