uartois / sonar-golang

Sonarqube plugin for the golang language.
GNU Lesser General Public License v3.0
245 stars 32 forks source link

Absolute paths break the scanner. #42

Closed pms1969 closed 6 years ago

pms1969 commented 6 years ago

Description

I have a project that I'm trying to analyse. When I run gometalinter I get the following report.xml file report.zip

I'm running the scanner inside a custom build docker container based on golang:1.9-alpine. I run gometalinter and the other commands, then run sonar-scanner. This results in the error outlined later.

Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [and so on...]

Content of your sonar-project.properties

sonar.projectKey=test:master
sonar.projectName=test
sonar.golint.reportPath=report.xml
sonar.coverage.reportPath=coverage.xml
sonar.coverage.dtdVerification=false
sonar.test.reportPath=test.xml
sonar.sources=/go/src/test
sonar.exclusions="vendor"

Log of sonar-scanner related to the plugin

.
.
.
INFO: Sensor GoMetaLinter issues loader sensor [golang]                                                                                                                                                   
INFO: Parsing the file report.xml                                                                                                                                                                         
INFO: Parsing 'GoMetaLinter' Analysis Results                                                                                                                                                             
INFO: Load /key.properties                                                                                                                                                                                
INFO: loaded 49                                                                                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go                                                                                                                           
ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go     
.
.
.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 8.691s
INFO: Final Memory: 45M/321M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
java.lang.NullPointerException
        at java.io.File.<init>(File.java:277)
        at org.sonar.api.batch.fs.internal.AbsolutePathPredicate.get(AbsolutePathPredicate.java:52)
        at org.sonar.api.batch.fs.internal.DefaultFileSystem.inputFiles(DefaultFileSystem.java:149)
        at org.sonar.api.batch.fs.internal.DefaultFileSystem.inputFile(DefaultFileSystem.java:115)
        at fr.univartois.sonargo.gotest.GoTestReportSaver.save(GoTestReportSaver.java:47)
        at fr.univartois.sonargo.gotest.GoTestSensor.execute(GoTestSensor.java:66)
        at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
        at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
        at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
        at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
        at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:288)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:283)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:261)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
        at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
        at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
        at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
        at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:111)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at com.sun.proxy.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
        at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
        at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

Versions

Sonar: Version 6.7 (build 33306) Go-Plugin: 1.2.11-rc3

thibaultfalque commented 6 years ago

Hi, Please test the new release rc5.

thibaultfalque commented 6 years ago

@pms1969 can you close the issue if it's ok ?

thibaultfalque commented 6 years ago

@pms1969 can you test the rc7 version.

pms1969 commented 6 years ago

Sorry, I'm away until the new year. Will test then.

thibaultfalque commented 6 years ago

Please check release 1.2.11-RC8.

thibaultfalque commented 6 years ago

@pms1969 could you check with the last release and close the issue if the problem is resolved ?

thibaultfalque commented 6 years ago

@pms1969 could you check with the last release and close the issue if the problem is resolved ?

psandhu79 commented 6 years ago

Is this fixed i am getting simiar error to this ERROR: Not able to find a InputFile with .//usr/local/go/src/net/lookup_unix.go the file does exist here /usr/local/go/src/net/lookup_unix.go i am not sure if the .// has any significance

pms1969 commented 6 years ago

My apologies for the delay. I can confirm that in 1.2.11, the issue no longer exists.