codacy / codacy-coverage-reporter

Multi-language coverage reporter for Codacy
https://www.codacy.com
Other
134 stars 94 forks source link

[Java] Fail to parse Jacoco report #56

Closed gaocegege closed 7 years ago

gaocegege commented 7 years ago

Are you looking for help?

Yes

Scala Version

Scala code runner version 2.11.5 -- Copyright 2002-2013, LAMP/EPFL

Operating System

macOS 10.12.4

Darwin <user> 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

JDK

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)

codacy-coverage-reporter-assembly.jar

2.0.0

Expected Behavior

  1. Set the commitUID and projectToken before running the reporter
  2. Run java -cp codacy-coverage-reporter-assembly.jar com.codacy.CodacyCoverageReporter --debug -l Java -r ./test-output/site/jacoco/report.xml
  3. Get the result in codacy-coverage.json

FYI: ./test-output/site/jacoco/report.xml

Actual Behavior

codacy-coverage.json

{"total":0,"fileReports":[]}

DEBUG log

16:26:08,335 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback-test.xml] at [jar:file:/Users/gaoce/Projects/GitHub/Processing.R/scripts/codacy-coverage-reporter-assembly.jar!/logback-test.xml]
16:26:08,351 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@13b6d03 - URL [jar:file:/Users/gaoce/Projects/GitHub/Processing.R/scripts/codacy-coverage-reporter-assembly.jar!/logback-test.xml] is not of type file
16:26:08,396 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
16:26:08,396 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
16:26:08,402 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
16:26:08,409 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
16:26:08,436 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@f5f2bb7 - There is no conversion class registered for conversion word [coloredLevel]
16:26:08,436 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@f5f2bb7 - [coloredLevel] is not a valid conversion word
16:26:08,464 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [play] to INFO
16:26:08,464 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [application] to DEBUG
16:26:08,464 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
16:26:08,464 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
16:26:08,464 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
16:26:08,465 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@73035e27 - Registering current configuration as safe fallback point

2017-06-04 16:26:08,741 %PARSER_ERROR[coloredLevel] com.codacy Config(Java,false, <mock>,./test-output/site/jacoco/report.xml,https://api.codacy.com,,true,Some(651cf1223cda083573e741ad582b12e323e1f5aa))
2017-06-04 16:26:08,795 %PARSER_ERROR[coloredLevel] com.codacy Project token:<mock>
2017-06-04 16:26:08,795 %PARSER_ERROR[coloredLevel] com.codacy Parsing coverage data...
2017-06-04 16:26:09,052 %PARSER_ERROR[coloredLevel] com.codacy Saving parsed report to /Users/gaoce/Projects/GitHub/Processing.R/./test-output/site/jacoco/codacy-coverage.json
2017-06-04 16:26:09,052 %PARSER_ERROR[coloredLevel] com.codacy CoverageReport(0,List())
2017-06-04 16:26:09,218 %PARSER_ERROR[coloredLevel] com.codacy Uploading coverage data...
2017-06-04 16:26:11,667 %PARSER_ERROR[coloredLevel] com.codacy Coverage data uploaded. RequestSuccess(Coverage received successfully.)

Reproducible Test Case

https://github.com/gaocegege/Processing.R

You could get my report in xml format here: https://pastebin.com/86b40S0L

gaocegege commented 7 years ago

There is an error about logback, I am not sure if it matters.

16:26:08,436 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@f5f2bb7 - There is no conversion class registered for conversion word [coloredLevel]
16:26:08,436 |-ERROR in ch.qos.logback.core.pattern.parser.Compiler@f5f2bb7 - [coloredLevel] is not a valid conversion word
gaocegege commented 7 years ago

And I think the token should be hidden even in DEBUG mode šŸ¤”

rtfpessoa commented 7 years ago

Sorry for the delay, we will create an internal task to track this.

For future issues, if you use support at codacy dot com you will get faster asnwers.

gaocegege commented 7 years ago

Thanks for your reply :smile: Got it.

pedrorijo91 commented 7 years ago

Hey @gaocegege,

I've been looking at your problem.

  1. This seems more of a problem for the coverage-parser repository.
  2. The parser looks for LINE coverage: https://github.com/codacy/coverage-parser/blob/master/src/main/scala/com/codacy/parsers/implementation/JacocoParser.scala#L20
  3. From what I can see in your coverage file, your report doesn't have LINE coverage info

Can you have a look at why are you not generating LINE coverage information on your report?

(closing this issue, feel free to comment anyway, or to open the issue in the coverage-parser repository)

gaocegege commented 7 years ago

Thank you and I will take a look.