rubycritic
rubycritic copied to clipboard
Coverage page ignores .resultset.json
I run specs on Travis CI for pull-requests, but I use Jenkins to generate docs on deployment. I host these directly from Jenkins. So far, I'm able to generate all Rubycritic pages except coverage. Coverage recognizes all my files, but fails to utilize the .resultset.json file I have committed to the repo. All files show up with 0% coverage, even though SimpleCov reports 77% coverage when I look at the results after running my specs.
any news on this issue? @eprislac were you able to get coverage results in the rubycritic report?
I have a similar issue on CircleCI.
- run:
name: RubyCritic
command: bundle exec rubycritic --no-browser --path artifacts/rubycritic
- store_artifacts:
path: artifacts
and
SimpleCov.start 'rails' do
add_filter 'vendor'
end
SimpleCov.coverage_dir('artifacts/coverage')
in spec_helper.rb.
Then, CircleCI stores .resultset.json and rubycritic~ files like this:

However, the RubyCritic coverage page ignores the coverage JSON. It looks like RubyCritic assumes the default coverage directory is always used. https://github.com/whitesmith/rubycritic/blob/3bc857d2ca399341f4cfff19519cb32cbf29ad78/lib/rubycritic/analysers/coverage.rb#L51
I think it should support different coverage dir, something like this:
SimpleCov.coverage_dir(ENV['RUBYCRITIC_COVERAGE_PATH`]) if ENV['RUBYCRITIC_COVERAGE_PATH`]
The below worked for me. Both coverage and rubycritic results are successfully stored in CircleCI, and RubyCritic coverage page shows coverage successfully.
- run:
name: RSpec
command: COVERAGE=1 bundle exec rspec
- store_artifacts:
path: coverage
- run:
name: RubyCritic
command: bundle exec rubycritic --no-browser --path rubycritic
- store_artifacts:
path: rubycritic
and
SimpleCov.start 'rails' do
add_filter 'vendor'
end
# SimpleCov.coverage_dir('artifacts/coverage')
# Do not customize since the current implementation of RubyCritic expects
# the result set file in the default directory.
This was fixed by https://github.com/whitesmith/rubycritic/pull/481 (based on #364)
@eprislac @exoego Thanks for reporting and thanks for your PR!