green-code-initiative / ecoCode-android

Reduce the environmental footprint of your Java-based Android apps with SonarQube
https://ecocode.io
GNU General Public License v3.0
57 stars 17 forks source link

Crash of Sonar scanner #19

Open dedece35 opened 1 year ago

dedece35 commented 1 year ago

Describe the bug During maven sonar scanner, an error occured :

INFO: 5937 files indexed
INFO: 14287 files ignored because of inclusion/exclusion patterns
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for css: Sonar-Solocal
INFO: Quality profile for grvy: ecoCode
INFO: Quality profile for js: Sonar way
INFO: Quality profile for json: Sonar way
INFO: Quality profile for ts: Sonar way
INFO: Quality profile for web: Sonar way
INFO: ------------- Run sensors on module yelster/solocal-manager/services/frontend
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=26ms
INFO: Sensor GroovySensor [ecocodeandroid]
java.io.IOException: Stream closed
    at java.base/java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:165)
    at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252)
    at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:271)
    at java.base/java.io.DataInputStream.readUnsignedShort(DataInputStream.java:342)
    at java.base/java.io.DataInputStream.readUTF(DataInputStream.java:594)
    at java.base/java.io.DataInputStream.readUTF(DataInputStream.java:569)
    at org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord.loadDgmInfo(GeneratedMetaMethod.java:1[88](https://gitlab.solocal.com/yelster/solocal-manager/services/frontend/-/jobs/5639403#L88))
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:205)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:112)
    at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:[90](https://gitlab.solocal.com/yelster/solocal-manager/services/frontend/-/jobs/5639403#L90))
    at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)
    at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:82)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.createList(ScriptBytecodeAdapter.java:624)
    at org.gmetrics.metric.AbstractMetric.<init>(AbstractMetric.groovy:36)
    at org.gmetrics.metric.AbstractMethodMetric.<init>(AbstractMethodMetric.groovy)
    at org.gmetrics.metric.cyclomatic.CyclomaticComplexityMetric.<init>(CyclomaticComplexityMetric.groovy)
    at org.sonar.plugins.groovy.gmetrics.GMetricsSourceAnalyzer.<clinit>(GMetricsSourceAnalyzer.java:47)
    at org.sonar.plugins.groovy.GroovySensor.computeGroovyMetrics(GroovySensor.java:108)
    at org.sonar.plugins.groovy.GroovySensor.execute(GroovySensor.java:102)
    at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
    at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
    at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
    at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
    at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
    at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:401)
    at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:397)
    at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:366)
    at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
    at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
    at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:135)
    at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
    at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
    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(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    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:171)
    at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/root/.sonar/cache/a75708147b[95](https://gitlab.solocal.com/yelster/solocal-manager/services/frontend/-/jobs/5639403#L95)43958252c71d74de2[96](https://gitlab.solocal.com/yelster/solocal-manager/services/frontend/-/jobs/5639403#L96)e/sonar-ecocodeandroid-plugin.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------

This is because that there is some groovy code source in the project. Our SonarQube hadn't a Groovy profile, but after ecoCode-mobile plugin installation, a new built-in grooby profile appears with 3 rules. There is no way to disable this profile beacause it is a built-in profile and there is no way to disable all rules because it's mandatory to have at most one enabled rule in an active profile.

To Reproduce Steps to reproduce the behavior:

  1. install ecoCode-mobile plugin in a SonarQube instance that hasn't Groovy profile yet.
  2. launch mvn Sonar scanner on a project with Groovy source

Expected behavior No crash of Sonar scanner. No default Groovy profile installed by default.

Screenshots

Capture d’écran 2023-01-27 à 15 38 46

Desktop (please complete the following information):

jhertout commented 1 year ago

OK, two things:

Thanks