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
58 stars 18 forks source link

Cleaning / Checks errors during Sonar analyse phase #16

Open dedece35 opened 1 year ago

dedece35 commented 1 year ago

Describe the bug During "build" workflow (on push on "main" branch), some exceptions and errors occurs during last Sonar phase (which launch test pahse) Check if there are wanted or not and make corrections if not wanted.

To Reproduce Launch mvn test command on root directory of plugin

Expected behavior Maybe some errors avoided

Screenshots

- error type 5 : 

11:35:45.050 [main] WARN o.s.p.groovy.jacoco.JaCoCoExtensions - Exception during analysis of file /Users/ddecarvalho/git_perso/ecoCode-mobile/android-plugin/DummyFile.dummy java.io.FileNotFoundException: DummyFile.dummy (No such file or directory) at java.base/java.io.FileInputStream.open0(Native Method) ~[na:na] at java.base/java.io.FileInputStream.open(FileInputStream.java:219) ~[na:na]

- error type 6 : 

[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.992 s - in org.sonar.plugins.groovy.GroovySensorTest [INFO] Running org.sonar.plugins.groovy.codenarc.CodeNarcSensorTest 11:35:46.128 [main] WARN o.s.p.groovy.codenarc.CodeNarcSensor - No such rule in SonarQube, so violation from CodeNarc will be ignored: EmptyElseBlock 11:35:46.129 [main] WARN o.s.p.groovy.codenarc.CodeNarcSensor - No such rule in SonarQube, so violation from CodeNarc will be ignored: EmptyIfStatement 11:35:46.129 [main] WARN o.s.p.groovy.codenarc.CodeNarcSensor - No such rule in SonarQube, so violation from CodeNarc will be ignored: StringInstantiation 11:35:46.129 [main] WARN o.s.p.groovy.codenarc.CodeNarcSensor - No such rule in SonarQube, so violation from CodeNarc will be ignored: DuplicateImport 11:35:46.129 [main] WAR

jhertout commented 1 year ago

I think that with errors are related to Codenarc functions we do not use. I have planned to work on Codenarc to simplify it for our use cases and to simplify the build process. I will see these problems at that moment.