SCSS 文件分析失败?
Failed analysis for SCSS file?
我在使用通用 SonarQube 扫描仪分析我的项目时遇到错误。根据文档,这种扫描仪和服务器的组合是兼容的。
版本:
- SonarQube 5.6.4 LTS
- CSS / SCSS / 少插件3.0
- SonarQube scanner 2.8
有什么问题吗?
我有这个代码 (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
此文件针对规则 box-model 提出了 NPE - 应仔细审查盒子模型的大小。 GitHub 打开的问题:https://github.com/racodond/sonar-css-plugin/issues/115. A snapshot to test the fix is available at https://github.com/racodond/sonar-css-plugin/releases/tag/115
在错误修复发布之前,您可以停用此规则并继续进行分析。
我在使用通用 SonarQube 扫描仪分析我的项目时遇到错误。根据文档,这种扫描仪和服务器的组合是兼容的。
版本:
- SonarQube 5.6.4 LTS
- CSS / SCSS / 少插件3.0
- SonarQube scanner 2.8
有什么问题吗?
我有这个代码 (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
此文件针对规则 box-model 提出了 NPE - 应仔细审查盒子模型的大小。 GitHub 打开的问题:https://github.com/racodond/sonar-css-plugin/issues/115. A snapshot to test the fix is available at https://github.com/racodond/sonar-css-plugin/releases/tag/115
在错误修复发布之前,您可以停用此规则并继续进行分析。