0

sonar-scanner 3.0.3我在使用和分析 PHP/JS 项目时遇到了一些问题SonarQube 6.3.1

大多数情况下,分析会失败,但有时会通过(相同的配置)。

第一个错误发生在声纳扫描仪分析期间,如下所示:

Unable to analyse file: /home/www/sites/xxx/update.js
java.lang.UnsupportedOperationException: Trying to save highlighting twice for the same file is not supported: /home/www/sites/xxx/update.js
    at org.sonar.scanner.sensor.DefaultSensorStorage.store(DefaultSensorStorage.java:367)
    at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.doSave(DefaultHighlighting.java:119)
    at org.sonar.api.batch.sensor.internal.DefaultStorable.save(DefaultStorable.java:43)
    at org.sonar.javascript.highlighter.HighlighterVisitor.leaveFile(HighlighterVisitor.java:78)
    at org.sonar.plugins.javascript.api.visitors.SubscriptionVisitor.scanTree(SubscriptionVisitor.java:64)
    at org.sonar.plugins.javascript.JavaScriptSquidSensor.scanFile(JavaScriptSquidSensor.java:239)
    at org.sonar.plugins.javascript.JavaScriptSquidSensor.analyse(JavaScriptSquidSensor.java:177)
    at org.sonar.plugins.javascript.JavaScriptSquidSensor.analyseFiles(JavaScriptSquidSensor.java:146)
    at org.sonar.plugins.javascript.JavaScriptSquidSensor.execute(JavaScriptSquidSensor.java:343)
    at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
    at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
    at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:175)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:262)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:247)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
    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)

它可以发生在 JS 和 PHP 文件上。但有时声纳扫描仪的分析是成功的,当 SonarQube 尝试导入结果时,我会收到以下类型的错误。

ERROR ce[AV1gZEtgjo8EA_Py4PRF][o.s.s.c.t.CeWorkerCallableImpl] Failed to execute task AV1gZEtgjo8EA_Py4PRF
org.sonar.server.computation.task.projectanalysis.component.VisitException: Visit of Component {key=test:www/sites/xxx/file.tpl.php,uuid=AV1gViEHhosIOTM5w9ww,type=FILE} failed
    at org.sonar.server.computation.task.projectanalysis.component.VisitException.rethrowOrWrap(VisitException.java:44)
    at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:41)
    at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitChildren(DepthTraversalTypeAwareCrawler.java:98)
    at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:54)
    at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39)
    at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitChildren(DepthTraversalTypeAwareCrawler.java:98)
    at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:54)
    at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39)
    at org.sonar.server.computation.task.projectanalysis.step.LoadDuplicationsFromReportStep.execute(LoadDuplicationsFromReportStep.java:81)
    at org.sonar.server.computation.task.step.ComputationStepExecutor.executeSteps(ComputationStepExecutor.java:64)
    at org.sonar.server.computation.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:52)
    at org.sonar.server.computation.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:75)
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.executeTask(CeWorkerCallableImpl.java:85)
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:58)
    at org.sonar.server.computation.taskprocessor.CeWorkerCallableImpl.call(CeWorkerCallableImpl.java:36)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: file must be of type FILE
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
    at org.sonar.server.computation.task.projectanalysis.duplication.InProjectDuplicate.<init>(InProjectDuplicate.java:37)
    at org.sonar.server.computation.task.projectanalysis.step.LoadDuplicationsFromReportStep$BatchDuplicateToCeDuplicate.apply(LoadDuplicationsFromReportStep.java:114)
    at org.sonar.server.computation.task.projectanalysis.step.LoadDuplicationsFromReportStep$BatchDuplicateToCeDuplicate.apply(LoadDuplicationsFromReportStep.java:100)
    at com.google.common.collect.Iterators$8.transform(Iterators.java:799)
    at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
    at com.google.common.collect.Iterators$7.computeNext(Iterators.java:651)
    at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
    at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
    at com.google.common.collect.Iterators$7.computeNext(Iterators.java:650)
    at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
    at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
    at com.google.common.collect.Iterators.addAll(Iterators.java:361)
    at com.google.common.collect.Lists.newArrayList(Lists.java:160)
    at com.google.common.collect.Iterables.toCollection(Iterables.java:337)
    at com.google.common.collect.Iterables.toArray(Iterables.java:328)
    at com.google.common.collect.ImmutableSortedSet.copyOf(ImmutableSortedSet.java:356)
    at com.google.common.collect.FluentIterable.toSortedSet(FluentIterable.java:410)
    at org.sonar.server.computation.task.projectanalysis.duplication.Duplication.<init>(Duplication.java:55)
    at org.sonar.server.computation.task.projectanalysis.step.LoadDuplicationsFromReportStep.loadDuplications(LoadDuplicationsFromReportStep.java:89)
    at org.sonar.server.computation.task.projectanalysis.step.LoadDuplicationsFromReportStep.access$100(LoadDuplicationsFromReportStep.java:48)
    at org.sonar.server.computation.task.projectanalysis.step.LoadDuplicationsFromReportStep$1.visitFile(LoadDuplicationsFromReportStep.java:74)
    at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitNode(DepthTraversalTypeAwareCrawler.java:79)
    at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visitImpl(DepthTraversalTypeAwareCrawler.java:57)
    at org.sonar.server.computation.task.projectanalysis.component.DepthTraversalTypeAwareCrawler.visit(DepthTraversalTypeAwareCrawler.java:39)
    ... 21 common frames omitted

有人知道这些错误是否相关,它们是什么意思?(我想我理解但我觉得很奇怪,不知道如何解决它)

编辑 1 [21/07/2017]

SonarJS 的版本是 3.1.1(内部版本 5128)。

SonarPHP 的版本是 2.10.0.2087。

SonarXML 的版本是 1.4.3(内部版本 1027)。

我认为文件的内容无关紧要,因为这次我得到了与以下 XML 文件完全相同的异常:

<?xml version="1.0" encoding="UTF-8"?>
<Book lang="fr" title="Titre" uuid="bbbbb">
    <Sections>
        <Section><![CDATA[Toutes sections-->About]]></Section>
    </Sections>
    <Cibles>
        <Cible>Entreprise</Cible>
    </Cibles>

    <menu name="main-menu" title="Titre" weight="42"
        id="submenu" path="&lt;nolink&gt;" lang="fr"
        uuid="ccccc" />
    <html><![CDATA[
        <h2>Titre</h2>
        <p>All about our company.</p>
    ]]></html>
</Book>

例外是一样的:

    ERROR: Error during SonarQube Scanner execution
org.sonar.squidbridge.api.AnalysisException: Unable to analyse file /xxx/About-Fr.xml
    at org.sonar.plugins.xml.XmlSensor.processException(XmlSensor.java:195)
    at org.sonar.plugins.xml.XmlSensor.execute(XmlSensor.java:158)
    at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
    at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
    at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:175)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:262)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:257)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:247)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:128)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
    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)
Caused by: java.lang.UnsupportedOperationException: Trying to save highlighting twice for the same file is not supported: /xxx/About-Fr.xml
    at org.sonar.scanner.sensor.DefaultSensorStorage.store(DefaultSensorStorage.java:367)
    at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.doSave(DefaultHighlighting.java:119)
    at org.sonar.api.batch.sensor.internal.DefaultStorable.save(DefaultStorable.java:43)
    at org.sonar.plugins.xml.XmlSensor.saveSyntaxHighlighting(XmlSensor.java:117)
    at org.sonar.plugins.xml.XmlSensor.runChecks(XmlSensor.java:104)
    at org.sonar.plugins.xml.XmlSensor.execute(XmlSensor.java:154)
    ... 30 more
4

0 回答 0