jenkinsci / rubymetrics-plugin

Ruby metric reports for Jenkins. Rcov, Rails stats, Rails notes and Flog.
https://plugins.jenkins.io/rubyMetrics/
25 stars 28 forks source link

SimpleCov support #11

Open ghost opened 12 years ago

ghost commented 12 years ago

RCov does not work on Ruby 1.9. SimpleCov is Ruby 1.9's code coverage tool. Add support for SimpleCov

martin-naumann commented 12 years ago

+1

simonoff commented 11 years ago

+1

bf4 commented 11 years ago

PR? or just R?

pekkama commented 10 years ago

+1

bf4 commented 10 years ago

I don't even understand what this ticket means. Just run simplecov along with your suite and use the HTML publisher plugin. It should be closed.

skord commented 10 years ago

@bf4 Why? Because of health concerns:

selection_023

It's much easier to take a look at that than go look at a bunch of reports somewhere else.

Here's the exception if it matters:

Publishing rcov report...
ERROR: Publisher hudson.plugins.rubyMetrics.rcov.RcovPublisher aborted due to exception
hudson.util.IOException2: cannot parse rcov report file
    at hudson.plugins.rubyMetrics.rcov.RcovParser.parse(RcovParser.java:61)
    at hudson.plugins.rubyMetrics.rcov.RcovParser.parse(RcovParser.java:34)
    at hudson.plugins.rubyMetrics.rcov.RcovPublisher.perform(RcovPublisher.java:51)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
    at hudson.model.Run.execute(Run.java:1770)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:89)
    at hudson.model.Executor.run(Executor.java:240)
Caused by: org.htmlparser.util.ParserException: cannot parse rcov report file, report element wasn't found
    at hudson.plugins.rubyMetrics.rcov.RcovParser.getReportTable(RcovParser.java:71)
    at hudson.plugins.rubyMetrics.rcov.RcovParser.parse(RcovParser.java:42)
    ... 11 more
Notifying upstream projects of job completion
skord commented 10 years ago

Update, it looks like the following makes this work:

require 'simplecov'
require 'simplecov-rcov'
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
SimpleCov.start 'rails'
nicocesar commented 9 years ago

@skord any idea if this was updated upstream?

Unknown-Guy commented 8 years ago

Was fighting with this today also. The coverage/index.html generated by SimpleCov::Formatter::HTMLFormatter from simplecov does not have the format https://github.com/jenkinsci/rubymetrics-plugin/blob/master/src/main/java/hudson/plugins/rubyMetrics/rcov/RcovParser.java expects. The simplecov-rcov gem providesSimpleCov::Formatter::RcovFormatter which generates the expected format in the coverage/rcov/index.html

That's why it works like @skord posted.

So to support SimpleCov this plugin should read .last_run.json. Think it only provides total code coverage though and not total coverage. At least that's my understanding.