Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Codacy::Parser breaks when using simplecov 0.18 #50

Closed
Looooong opened this issue Feb 3, 2020 · 3 comments
Closed

Codacy::Parser breaks when using simplecov 0.18 #50

Looooong opened this issue Feb 3, 2020 · 3 comments

Comments

@Looooong
Copy link

Looooong commented Feb 3, 2020

I'm using codacy-coverage 2.2.0 and I have recently updated simplecov from 0.17 to 0.18 and Codacy coverage reporter starts throwing error after testing:

I, [2020-02-03T14:19:44.876552 #17970]  INFO -- : Parsing simplecov result to Codacy format...
F, [2020-02-03T14:19:44.882050 #17970] FATAL -- : undefined method `>' for #<Array:0x0000562bd59d35d0> (NoMethodError)
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/codacy-coverage-2.2.0/lib/codacy/parser.rb:19:in `block (2 levels) in parse_file'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/codacy-coverage-2.2.0/lib/codacy/parser.rb:19:in `count'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/codacy-coverage-2.2.0/lib/codacy/parser.rb:19:in `block in parse_file'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/codacy-coverage-2.2.0/lib/codacy/parser.rb:10:in `each'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/codacy-coverage-2.2.0/lib/codacy/parser.rb:10:in `map'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/codacy-coverage-2.2.0/lib/codacy/parser.rb:10:in `parse_file'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/codacy-coverage-2.2.0/lib/codacy/formatter.rb:6:in `format'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/simplecov-0.18.1/lib/simplecov/formatter/multi_formatter.rb:10:in `block in format'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/simplecov-0.18.1/lib/simplecov/formatter/multi_formatter.rb:8:in `map'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/simplecov-0.18.1/lib/simplecov/formatter/multi_formatter.rb:8:in `format'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/simplecov-0.18.1/lib/simplecov/result.rb:49:in `format!'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/simplecov-0.18.1/lib/simplecov/configuration.rb:196:in `block in at_exit'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/simplecov-0.18.1/lib/simplecov.rb:201:in `run_exit_tasks!'
/home/long/.rvm/gems/ruby-2.6.5@cems/gems/simplecov-0.18.1/lib/simplecov/defaults.rb:31:in `block in <top (required)>'

After digging in the code, simplecov_result.original_result (in Codacy::Parser) format is found to be changed. In simplecov 0.17, the format is:

simplecov_result.original_result = {
  '/path/to/file' => [nil, 0, 1, nil, 0, 1,...]
}

In version 0.18, this format is changed to:

simplecov_result.original_result = {
  '/path/to/file' => {
    'lines' => [nil, 0, 1, nil, 0, 1,...],
    'branches' => {...},
  }
}
@wagnerpereira
Copy link

+1

@wagnerpereira
Copy link

workaround:

group :test do
  # Note: simplecov version regressed from 0.18.1 to 0.17.1 until fix:
  # https://github.com/codacy/ruby-codacy-coverage/issues/50  
  gem 'simplecov', '0.17.1', :require => false
  gem 'codacy-coverage', :require => false
end

@mrfyda
Copy link
Contributor

mrfyda commented Feb 18, 2020

@Looooong @wagnerpereira we're deprecating this reporter in favor of https://github.com/codacy/codacy-coverage-reporter. a new version is available now!
the new reporter is language agnostic, easier to install and contains many bug fixes that were never ported to this reporter.

@mrfyda mrfyda closed this as completed Feb 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants