Module: SimpleCov::UselessResultsRemover
- Defined in:
- lib/simplecov/useless_results_remover.rb
Overview
Drop coverage entries whose paths live outside SimpleCov.root so the
report only reflects the project's own source. Vendored gems, stdlib
files, and anything else that happens to have been touched during the
run never make it into the formatted result.
Class Method Summary collapse
- .call(coverage_result) ⇒ Object
-
.root_regex ⇒ Object
The
/iflag covers case-insensitive matches on Windows / macOS-HFS+ where the on-disk path's case can differ fromSimpleCov.root's. - .root_regx ⇒ Object
Class Method Details
.call(coverage_result) ⇒ Object
9 10 11 |
# File 'lib/simplecov/useless_results_remover.rb', line 9 def self.call(coverage_result) coverage_result.select { |path, _coverage| path.match?(root_regex) } end |
.root_regex ⇒ Object
The /i flag covers case-insensitive matches on Windows / macOS-HFS+
where the on-disk path's case can differ from SimpleCov.root's.
15 16 17 18 19 20 21 |
# File 'lib/simplecov/useless_results_remover.rb', line 15 def self.root_regex root = SimpleCov.root return @root_regex if root == @root_regex_root @root_regex_root = root @root_regex = /\A#{Regexp.escape(root.chomp(File::SEPARATOR) + File::SEPARATOR)}/i end |
.root_regx ⇒ Object
23 24 25 |
# File 'lib/simplecov/useless_results_remover.rb', line 23 def self.root_regx root_regex end |