我正在尝试创建一个Jenkins构建来为我的应用程序的客户端部分(eslint和测试覆盖率)生成报告。
我还有其他工作可以为同一个Jenkins和Sonar上的不同项目生成声纳报告。要生成lcov.info文件,我将mocha与lcov reporter一起使用。
其中一个不同之处在于,对于这个项目,我使用的是ES6与babel的反应,所有其他的都是角度ES5。
创建声纳状态的命令如下所示:
17:32:05.015 INFO - Sensor org.sonar.plugins.javascript.lcov.UTCoverageSensor@6e7302d...
17:32:05.016 INFO - Analysing D:\jenkins.space\jobs\XXX_Sonar_Runner\workspace\XXX.Web\app\coverage\lcov.info
17:32:05.026 DEBUG - Release semaphore on project : org.sonar.api.resources.Project@406ba622[id=14667,key=snapon:xxx:DEV_Jenkins,qualifier=TRK], with key batch-snapon:xxx:DEV_Jenkins
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 51.057s
INFO: Final Memory: 15M/236M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
java.lang.ArrayIndexOutOfBoundsException: 3
at org.sonar.plugins.javascript.lcov.LCOVParser.parse(LCOVParser.java:104)
at org.sonar.plugins.javascript.lcov.LCOVParser.<init>(LCOVParser.java:54)
at org.sonar.plugins.javascript.lcov.LCOVParser.create(LCOVParser.java:68)
at org.sonar.plugins.javascript.lcov.UTCoverageSensor.saveMeasureFromLCOVFile(UTCoverageSensor.java:112)
at org.sonar.plugins.javascript.lcov.UTCoverageSensor.analyse(UTCoverageSensor.java:85)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:119)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:194)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:233)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:228)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:221)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:125)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:173)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.BatchIsolatedLauncher.executeOldVersion(BatchIsolatedLauncher.java:86)
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:483)
at org.sonar.runner.impl.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
at com.sun.proxy.$Proxy0.executeOldVersion(Unknown Source)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:283)
at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:165)
at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:152)
at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:118)
at org.sonarsource.scanner.cli.Main.execute(Main.java:80)
at org.sonarsource.scanner.cli.Main.main(Main.java:66)
如果我删除“-Dsonar.javascript.lcov.reportPath = XXX.Web / app / coverage / lcov.info”,它可以正常工作,并生成其余的结果。
你知道它失败的原因吗?
日志如下所示:
_(data)
.uniqBy('city_id')
.map(_.partialRight(_.omit, 'store_id'))
.map(i => _.defaults({
store_ids: _(data)
.filter({ city_id: i.city_id })
.map('store_id')
.value()
}, i))
.value();