Class: Testgenai::Scanner::SimplecovScanner
- Defined in:
- lib/testgenai/scanner/simplecov_scanner.rb
Constant Summary collapse
- RESULTSET_PATH =
"coverage/.resultset.json"
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(root: Dir.pwd) ⇒ SimplecovScanner
constructor
A new instance of SimplecovScanner.
- #scan ⇒ Object
Constructor Details
#initialize(root: Dir.pwd) ⇒ SimplecovScanner
Returns a new instance of SimplecovScanner.
8 9 10 |
# File 'lib/testgenai/scanner/simplecov_scanner.rb', line 8 def initialize(root: Dir.pwd) @root = root end |
Instance Method Details
#scan ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/testgenai/scanner/simplecov_scanner.rb', line 12 def scan resultset_path = File.join(@root, RESULTSET_PATH) unless File.exist?(resultset_path) warn "Warning: #{RESULTSET_PATH} not found" return [] end coverage = merged_coverage source_coverage = coverage.reject { |file, _| test_file?(file) || !File.exist?(file) } @files_scanned = source_coverage.size source_coverage.flat_map { |file, lines| extract_untested_methods(file, lines) } end |