Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metric 'test_data' should not be computed by a Sensor #61

Closed
giacgbj opened this issue Dec 17, 2016 · 12 comments
Closed

Metric 'test_data' should not be computed by a Sensor #61

giacgbj opened this issue Dec 17, 2016 · 12 comments

Comments

@giacgbj
Copy link

giacgbj commented Dec 17, 2016

Since SonarQube 6.2, the following blocking error occurs:

[11:16:10]: ▸ ERROR: Error during SonarQube Scanner execution
[11:16:10]: ▸ org.sonar.api.utils.XmlParserException: Cannot parse surefire reports
[11:16:10]: ▸ at org.sonar.plugins.swift.tests.SwiftSurefireParser.parseFiles(SwiftSurefireParser.java:142)
[11:16:10]: ▸ at org.sonar.plugins.swift.tests.SwiftSurefireParser.collect(SwiftSurefireParser.java:74)
[11:16:10]: ▸ at org.sonar.plugins.swift.tests.SwiftSurefireSensor.collect(SwiftSurefireSensor.java:87)
[11:16:10]: ▸ at org.sonar.plugins.swift.tests.SwiftSurefireSensor.analyse(SwiftSurefireSensor.java:81)
[11:16:10]: ▸ at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
[11:16:10]: ▸ at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
[11:16:10]: ▸ at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
[11:16:10]: ▸ at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:182)
[11:16:10]: ▸ at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
[11:16:10]: ▸ at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
[11:16:10]: ▸ at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:247)
[11:16:10]: ▸ at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:242)
[11:16:10]: ▸ at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:232)
[11:16:10]: ▸ at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
[11:16:10]: ▸ at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
[11:16:10]: ▸ at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
[11:16:10]: ▸ at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
[11:16:10]: ▸ at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
[11:16:10]: ▸ at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
[11:16:10]: ▸ at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:115)
[11:16:10]: ▸ at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:116)
[11:16:10]: ▸ at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
[11:16:10]: ▸ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[11:16:10]: ▸ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[11:16:10]: ▸ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[11:16:10]: ▸ at java.lang.reflect.Method.invoke(Method.java:498)
[11:16:10]: ▸ at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
[11:16:10]: ▸ at com.sun.proxy.$Proxy0.execute(Unknown Source)
[11:16:10]: ▸ at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
[11:16:10]: ▸ at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
[11:16:10]: ▸ at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110)
[11:16:10]: ▸ at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
[11:16:10]: ▸ at org.sonarsource.scanner.cli.Main.main(Main.java:61)
[11:16:10]: ▸ Caused by: java.lang.UnsupportedOperationException: Metric 'test_data' should not be computed by a Sensor
[11:16:10]: ▸ at org.sonar.scanner.sensor.DefaultSensorStorage.saveMeasure(DefaultSensorStorage.java:240)
[11:16:10]: ▸ at org.sonar.scanner.index.DefaultIndex.addMeasure(DefaultIndex.java:231)
[11:16:10]: ▸ at org.sonar.scanner.deprecated.DeprecatedSensorContext.saveMeasure(DeprecatedSensorContext.java:131)
[11:16:10]: ▸ at org.sonar.plugins.swift.tests.SwiftSurefireParser.saveTestsDetails(SwiftSurefireParser.java:167)
[11:16:10]: ▸ at org.sonar.plugins.swift.tests.SwiftSurefireParser.parseFiles(SwiftSurefireParser.java:135)
[11:16:10]: ▸ ... 32 more
@jkernech
Copy link

I face exactly the same issue, @giacgbj did you some kind of workaround ?

@giacgbj
Copy link
Author

giacgbj commented Dec 20, 2016

@jkernech I don't think you can avoid it. The code must be changed.
Considering the names of the classes involved, you can try not to generate test reports in order to avoid, at least, that exception.

@jkernech
Copy link

@giacgbj Thanks for you feedback, I will check this out

@skromberg
Copy link

@giacgbj @jkernech : a quick fix is to comment out the following line:

org.sonar.plugins.swift.tests.SwiftSurefireParser; Line 167:

context.saveMeasure(resource, new Measure(CoreMetrics.TEST_DATA, testCaseDetails.toString()));

@jmich41
Copy link

jmich41 commented Jan 27, 2017

with this fix, script shows me "Done linting! Found 600 violations, 87 serious in 57 files." but in SonarQube I see only 2

@MrJre
Copy link

MrJre commented Feb 2, 2017

Running into the same issue. It appears that CoreMetrics.TEST_DATA is deprecated;
Same for MutableTestPlan mentioned.

@heyjas0n
Copy link

heyjas0n commented Feb 7, 2017

Running into same issue, anybody know when this will be resolved? Is there something we can disable in our sonar-project.properties file so that we can skip this step and it doesn't break our Jenkins pipeline?

@zippy1978
Copy link
Contributor

Hi,

The problem is due to API deprecation since SonarQube 6.2.

I will fix it as soon as I'm back from holidays.

@NicolaDeFiorenze
Copy link

+1

2 similar comments
@MartinaMuscarella
Copy link

+1

@velthune
Copy link

+1

@zippy1978
Copy link
Contributor

Hi all !

Issue is fixed in release 0.3.2

Enjoy !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants