Skip to content

SimpleCov.results doesn't handle :nocov: #146

@J5

Description

@J5

We use the results from simplecov to error out if we are not at 100% coverage. However if we put :nocov: lines in our source code the results will show < 100% coverage corresponding to the number of lines marked by nocov. The report output by SimpleCov-html does show 100% coverage.

While looking through simplecov's sources I noticed that SourceFile has facilities to account for this but Result seems to be working on a raw hash of integers and counting skipped lines as missed in the missed_line method. By overriding the missed_line method and looking for :nocov: tokens I have been able to workaround the issue but I'm assuming Result needs to be completely refactored:

class SimpleCov::Result
def missed_lines
return @missed_lines if defined? @missed_lines
@missed_lines = 0
@files.each do |file|
@missed_lines += file.missed_lines.count
end
@missed_lines
end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions