JAM-Software / SonarDelphi

This repository contains the source code to the Sonar-Delphi plugin. Can be used to analyse Delphi projects with SonarQube.
31 stars 12 forks source link

Error: Analyzing class parents for no active class #25

Open Lucas-VF opened 2 years ago

Lucas-VF commented 2 years ago

Sonar 8.2 Scanner 4.2 Plugin 1.0.7

I Catch an error when I parse a unit that has undeclared CustomAttributes on it. When the declaration and usage are in the same file the error does not occur. Error details:

07:02:58.203 DEBUG: >> PARSING C:\Fontes\Delphi\SonarQube\DelphiProjectForSonar\CustonAtrib.View.SonarQube.pas
07:02:58.534 DEBUG: Error analyzing file: Analyzing class parents for no active class C:\Fontes\Delphi\SonarQube\DelphiProjectForSonar\CustonAtrib.View.SonarQube.pas
java.lang.IllegalStateException: Analyzing class parents for no active class
        at org.sonar.plugins.delphi.antlr.analyzer.impl.TypeInheritanceAnalyzer.doAnalyze(TypeInheritanceAnalyzer.java:43)
        at org.sonar.plugins.delphi.antlr.analyzer.CodeAnalyzer.analyze(CodeAnalyzer.java:51)
        at org.sonar.plugins.delphi.antlr.analyzer.CodeAnalyzer.analyze(CodeAnalyzer.java:54)
        at org.sonar.plugins.delphi.antlr.analyzer.CodeAnalyzer.analyze(CodeAnalyzer.java:54)
        at org.sonar.plugins.delphi.antlr.analyzer.CodeAnalyzer.analyze(CodeAnalyzer.java:54)
        at org.sonar.plugins.delphi.antlr.analyzer.CodeAnalyzer.analyze(CodeAnalyzer.java:54)
        at org.sonar.plugins.delphi.antlr.analyzer.CodeAnalyzer.analyze(CodeAnalyzer.java:54)
        at org.sonar.plugins.delphi.antlr.analyzer.DelphiASTAnalyzer.analyze(DelphiASTAnalyzer.java:57)
        at org.sonar.plugins.delphi.DelphiSensor.analyseSourceFile(DelphiSensor.java:308)
        at org.sonar.plugins.delphi.DelphiSensor.parseSourceFile(DelphiSensor.java:278)
        at org.sonar.plugins.delphi.DelphiSensor.parseFiles(DelphiSensor.java:257)
        at org.sonar.plugins.delphi.DelphiSensor.execute(DelphiSensor.java:117)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:386)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:382)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:351)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        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:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)

Example project: DelphiProjectForSonar