ecoCode-android icon indicating copy to clipboard operation
ecoCode-android copied to clipboard

Cleaning / Checks errors during Sonar analyse phase

Open dedece35 opened this issue 3 years ago • 1 comments

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 1 :
10:16:18.936 [main] WARN  o.s.p.groovy.jacoco.JaCoCoExtensions - Exception during analysis of file /home/runner/work/ecoCode-mobile/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 2 :
[INFO] Running org.sonar.plugins.groovy.cobertura.CoberturaSensorTest
11:35:44.619 [main] INFO  o.s.p.g.cobertura.CoberturaSensor - Analyzing Cobertura report: Optional[/Users/ddecarvalho/git_perso/ecoCode-mobile/android-plugin/target/test-classes/org/sonar/plugins/groovy/cobertura/coverage.xml]
11:35:44.631 [main] INFO  o.s.p.g.c.CoberturaReportParser - Hit on invalid line for file com/test/web/EmptyResultException.java (line: 16/-1)
11:35:44.631 [main] INFO  o.s.p.g.c.CoberturaReportParser - Hit on invalid line for file com/test/web/EmptyResultException.java (line: 17/-1)
11:35:44.631 [main] WARN  o.s.p.g.c.CoberturaReportParser - File not found: com/test/web/EmptyResultException.java
11:35:44.643 [main] WARN  o.s.p.g.c.CoberturaReportParser - File not found: LoggingFilters.groovy
11:35:44.644 [main] WARN  o.s.p.g.c.CoberturaReportParser - File not found: SiteMapFilters.groovy
  • error type 3 :
[INFO] Running org.sonar.plugins.groovy.foundation.GroovyHighlighterAndTokenizerTest
11:35:44.982 [main] ERROR o.s.p.g.f.GroovyHighlighterAndTokenizer - Unexpected token when lexing file: Error.groovy
groovyjarjarantlr.TokenStreamRecognitionException: unexpected char: '#'
        at org.codehaus.groovy.antlr.parser.GroovyLexer.nextToken(GroovyLexer.java:728) ~[groovy-2.4.17.jar:2.4.17]
        at org.codehaus.groovy.antlr.parser.GroovyLexer$1.nextToken(GroovyLexer.java:262) ~[groovy-2.4.17.jar:2.4.17]
  • error type 4 :
11:35:45.008 [main] ERROR o.s.p.g.f.GroovyHighlighterAndTokenizer - Unable to read file: Greet-fake.groovy
java.io.FileNotFoundException: /Users/ddecarvalho/git_perso/ecoCode-mobile/android-plugin/Greet-fake.groovy (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 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

dedece35 avatar Jan 06 '23 10:01 dedece35

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.

jhertout avatar Jan 30 '23 06:01 jhertout