1

使用通用 SonarQube 扫描仪分析我的项目时出现错误。根据文档,这种扫描仪和服务器的组合是兼容的。

版本:

有什么问题?

我有这个代码(typography.scss):

$rem-base: 16;

@function rem($px, $base: $rem-base) {
   @return ($px / $base) * 1rem;
}

@function em($px, $base: $rem-base) {
  @return ($px / $base) * 1em;
}

@mixin font-size($px, $base: $rem-base) {
  font-size: $px + px;
  font-size: rem($px);
}

这是分析的结果。请注意,一些 scss 文件似乎已通过分析:

07:57:03.786 DEBUG: Analyzing /data/source/assets/css/_base/colors.scss...
07:57:05.036 DEBUG: Analyzing /data/source/assets/css/_base/responsive.scss...
07:57:05.074 DEBUG: Analyzing /data/source/assets/css/_base/typography.scss...
07:57:05.138 INFO: ------------------------------------------------------------------------
07:57:05.138 INFO: EXECUTION FAILURE
07:57:05.138 INFO: ------------------------------------------------------------------------
07:57:05.141 INFO: Total time: 7:57.658s
07:57:05.376 INFO: Final Memory: 50M/127M
07:57:05.377 INFO: ------------------------------------------------------------------------
07:57:05.377 ERROR: Error during SonarQube Scanner execution
org.sonar.squidbridge.api.AnalysisException: Unable to analyze file: /data/source/assets/css/_base/typography.scss
at org.sonar.plugins.css.AbstractLanguageAnalyzerSensor.analyzeFile(AbstractLanguageAnalyzerSensor.java:148)
at org.sonar.plugins.css.AbstractLanguageAnalyzerSensor.execute(AbstractLanguageAnalyzerSensor.java:111)
at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
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:110)
at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.NullPointerException
at org.sonar.css.checks.common.BewareOfBoxModelCheck.visitNode(BewareOfBoxModelCheck.java:82)
at org.sonar.plugins.css.api.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:76)
at org.sonar.plugins.css.api.visitors.SubscriptionVisitor.visitChildren(SubscriptionVisitor.java:96)
at org.sonar.plugins.css.api.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:78)
at org.sonar.plugins.css.api.visitors.SubscriptionVisitor.visitChildren(SubscriptionVisitor.java:96)
at org.sonar.plugins.css.api.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:78)
at org.sonar.plugins.css.api.visitors.SubscriptionVisitor.visitChildren(SubscriptionVisitor.java:96)
at org.sonar.plugins.css.api.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:78)
at org.sonar.plugins.css.api.visitors.SubscriptionVisitor.scanTree(SubscriptionVisitor.java:70)
at org.sonar.plugins.css.api.visitors.SubscriptionVisitor.scanTree(SubscriptionVisitor.java:64)
at org.sonar.plugins.css.api.visitors.SubscriptionVisitorCheck.scanFile(SubscriptionVisitorCheck.java:40)
at org.sonar.plugins.css.AbstractLanguageAnalyzerSensor.scanFile(AbstractLanguageAnalyzerSensor.java:161)
at org.sonar.plugins.css.AbstractLanguageAnalyzerSensor.analyzeFile(AbstractLanguageAnalyzerSensor.java:138)
... 31 more
4

1 回答 1

1

在此文件中针对规则框模型提出了 NPE - 应仔细检查框模型大小。在 GitHub 上打开的问题:https ://github.com/racodond/sonar-css-plugin/issues/115 。可在https://github.com/racodond/sonar-css-plugin/releases/tag/115获得测试修复的快照

在发布错误修复之前,您可以停用此规则,您的分析应该会继续。

于 2017-01-27T08:42:58.000 回答