-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EcoCode Android 1.1.0 giving error while executing CodeNarc #81
Comments
Hello, thanks for your return. Unfortunately I am not able to reproduce your bug. Can you please give us some additional information:
Thanks, Julien Hertout |
Hi , android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-XX:MaxPermSize=512m
systemProp.sonar.host.url=<<..>>
systemProp.sonar.login=<<..>>
systemProp.sonar.projectKey=TF01-Android
systemProp.sonar.projectName=TF01-Android build.gradle is:
Aslo I dont see ekko (polar Bear) in sonarqube after scanning. Please help. Thanks & Regards |
HI, I tested a project with your app/build.gradle file but the file is a little more complex that what I was expected. Can you please give me your root repo build.gradle file? It will be easier for me. For Ekko, I am working on it too. It was not really designed to be in the "official" plugin version in the marketplace as we did not know if SonarSource will accept it and so it was not very well integrated (sorry about that). We know that some navigator or some network configuration blocks it as it is on a separate URL. Now that we know that it is ok, we will clean its integration for the next release. Thanks |
Hello @jhertout
Thanks & Regards |
Hello @jhertout Thanks & Regards |
Hello, I did not have time to work on the project at the end of the year. I began to work on the project today. I am trying to reproduce your problem but without success even with the files you gave to me. However I had to slightly modify them to have my project build and I did not consider the SonarQube version, sonar scanner etc... in my tests. I will follow my investigation since I have time next week. Hope this will be successful. A question just to be sure, do you have other gradle / groovy files in your project? Thanks |
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Sonar Scan is failing with below error:
$ sonar-scanner -Dsonar.host.url=<> -Dsonar.login=<> -Dsonar.projectKey=TF01-Android
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /builds/TF01/demoprod/TF01-Android/sonar-project.properties
INFO: SonarScanner 4.6.2.2472
INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
INFO: Linux 3.10.0-1160.88.1.el7.x86_64 amd64
INFO: User cache: /root/.sonar/cache
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /builds/TF01/demoprod/TF01-Android/sonar-project.properties
INFO: Analyzing on SonarQube server 9.9.2.77730
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=301ms
INFO: Server id: 924C346B-19d5d4f656ea30f
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=144ms
INFO: Load/download plugins (done) | time=5917ms
INFO: Loaded core extensions: developer-scanner
INFO: Process project properties
INFO: Process project properties (done) | time=25ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=5ms
INFO: Project key: TF01-Android
INFO: Base dir: /builds/TF01/demoprod/TF01-Android
INFO: Working dir: /builds/TF01/demoprod/TF01-Android/.scannerwork
INFO: Load project settings for component key: 'TF01-Android'
INFO: Load project settings for component key: 'TF01-Android' (done) | time=70ms
INFO: Load project branches
INFO: Load project branches (done) | time=58ms
INFO: Load branch configuration
INFO: Detected branch/PR in 'GitLab'
INFO: Auto-configuring branch 'ecoCode-Test'
INFO: Load branch configuration (done) | time=7ms
INFO: Auto-configuring with CI 'Gitlab CI'
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=117ms
INFO: Load active rules
INFO: Load active rules (done) | time=3340ms
INFO: Load analysis cache
INFO: Load analysis cache (404) | time=33ms
INFO: Branch name: ecoCode-Test
INFO: Load project repositories
INFO: Load project repositories (done) | time=61ms
INFO: Indexing files...
INFO: Project configuration:
INFO: Excluded sources: **.html, **.json, /assets/, **.java
INFO: 65 files indexed
INFO: 18 files ignored because of inclusion/exclusion patterns
INFO: Quality profile for grvy: ecoCode (Android)
INFO: Quality profile for xml: ecoCode (Android)
INFO: Quality profile for yaml: Sonar way
INFO: ------------- Run sensors on module TF01-Android
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=52ms
INFO: Sensor EcoCodeXmlSensor [ecocodeandroid]
INFO: 26 source files to be analyzed
INFO: 26/26 source files have been analyzed
INFO: Sensor EcoCodeXmlSensor [ecocodeandroid] (done) | time=1189ms
INFO: Sensor GroovySensor [ecocodeandroid]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/root/.sonar/cache/5a2b2e9a3e4dbe5816489e61e8c01a42/sonar-ecocodeandroid-plugin.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
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: GMetrics completed: 1125ms
INFO: Sensor GroovySensor [ecocodeandroid] (done) | time=1982ms
INFO: Sensor CodeNarc [ecocodeandroid]
INFO: Executing CodeNarc
INFO: Loaded properties file in 73ms; 397 rules
INFO: Loading ruleset from [file:/builds/TF01/demoprod/TF01-Android/.scannerwork/codenarc/profile.xml]
INFO: RuleSet configuration properties file [codenarc.properties] not found.
ERROR: Error from [org.codenarc.rule.ecocode.EC5001] processing source file [null]
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'org.codehaus.groovy.ast.expr.GStringExpression@5c7712f0[strings: [ConstantExpression[copyDependencies], ConstantExpression[]] values: [org.codehaus.groovy.ast.expr.MethodCallExpression@6ed836b3[object: org.codehaus.groovy.ast.expr.PropertyExpression@38849a1[object: org.codehaus.groovy.ast.expr.VariableExpression@769fbb26[variable: variant] property: ConstantExpression[name]] method: ConstantExpression[capitalize] arguments: org.codehaus.groovy.ast.expr.ArgumentListExpression@129bc797[]]]]' with class 'org.codehaus.groovy.ast.expr.GStringExpression' to class 'org.codehaus.groovy.ast.expr.ConstantExpression'
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:418)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:332)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:245)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:616)
at org.codenarc.rule.ecocode.EC5001AstVisitor.visitMethodCallExpression(EC5001.groovy:43)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitListOfExpressions(CodeVisitorSupport.java:326)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitTupleExpression(CodeVisitorSupport.java:231)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitArgumentlistExpression(CodeVisitorSupport.java:336)
at org.codehaus.groovy.ast.expr.ArgumentListExpression.visit(ArgumentListExpression.java:76)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitMethodCallExpression(CodeVisitorSupport.java:184)
at org.codenarc.rule.ecocode.EC5001AstVisitor.super$2$visitMethodCallExpression(EC5001.groovy)
at jdk.internal.reflect.GeneratedMethodAccessor43.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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:145)
at org.codenarc.rule.ecocode.EC5001AstVisitor.visitMethodCallExpression(EC5001.groovy:56)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
at org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitListOfExpressions(CodeVisitorSupport.java:326)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitTupleExpression(CodeVisitorSupport.java:231)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitArgumentlistExpression(CodeVisitorSupport.java:336)
at org.codehaus.groovy.ast.expr.ArgumentListExpression.visit(ArgumentListExpression.java:76)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitMethodCallExpression(CodeVisitorSupport.java:184)
at org.codenarc.rule.ecocode.EC5001AstVisitor.super$2$visitMethodCallExpression(EC5001.groovy)
at jdk.internal.reflect.GeneratedMethodAccessor43.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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:145)
at org.codenarc.rule.ecocode.EC5001AstVisitor.visitMethodCallExpression(EC5001.groovy:56)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
at org.codenarc.rule.AbstractAstVisitor.visitMethod(AbstractAstVisitor.java:155)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1081)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
at org.codenarc.rule.AbstractAstVisitor.visitClass(AbstractAstVisitor.java:132)
at org.codenarc.rule.AbstractAstVisitorRule.applyTo(AbstractAstVisitorRule.java:97)
at org.codenarc.rule.AbstractRule.applyTo(AbstractRule.java:143)
at org.codenarc.rule.Rule$applyTo.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codenarc.rule.Rule$applyTo.call(Unknown Source)
at org.codenarc.analyzer.AbstractSourceAnalyzer$_collectViolations_closure3.doCall(AbstractSourceAnalyzer.groovy: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.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at org.codenarc.analyzer.AbstractSourceAnalyzer.measureRuleProcessingTime(AbstractSourceAnalyzer.groovy:58)
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.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:64)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:177)
at org.codenarc.analyzer.AbstractSourceAnalyzer.collectViolations(AbstractSourceAnalyzer.groovy:44)
at org.sonar.plugins.groovy.codenarc.CodeNarcSourceAnalyzer.processFiles(CodeNarcSourceAnalyzer.java:61)
at org.sonar.plugins.groovy.codenarc.CodeNarcSourceAnalyzer.analyze(CodeNarcSourceAnalyzer.java:51)
at org.codenarc.analyzer.SourceAnalyzer$analyze.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at org.codenarc.CodeNarcRunner.execute(CodeNarcRunner.groovy:92)
at org.sonar.plugins.groovy.codenarc.CodeNarcSensor.runCodeNarc(CodeNarcSensor.java:168)
at org.sonar.plugins.groovy.codenarc.CodeNarcSensor.execute(CodeNarcSensor.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:403)
at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
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:137)
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(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)
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 28.762s
INFO: Final Memory: 58M/200M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: