Class: SixthSense::Analyzers::AdequacyCheckedCoverage
- Inherits:
-
SixthSense::Analyzer
- Object
- SixthSense::Analyzer
- SixthSense::Analyzers::AdequacyCheckedCoverage
- Defined in:
- lib/sixth_sense/analyzers/adequacy_checked_coverage.rb
Instance Method Summary collapse
-
#analyze(test_file, context) ⇒ Object
Paper basis: Schuler/Zeller 2011 (doi:10.1109/ICST.2011.32) defines checked coverage as executed code associated with an oracle.
Methods inherited from SixthSense::Analyzer
analyzer_id, axis, inherited, level, reference, references
Instance Method Details
#analyze(test_file, context) ⇒ Object
Paper basis: Schuler/Zeller 2011 (doi:10.1109/ICST.2011.32) defines checked coverage as executed code associated with an oracle.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sixth_sense/analyzers/adequacy_checked_coverage.rb', line 21 def analyze(test_file, context) checked = context.checked_coverage_map_for(test_file) return unmeasured(confidence: :low) unless checked&.checked_ratio findings = checked.unchecked_lines.first(10).map do |path, line| finding( rule_id: "unchecked_executed_line", severity: :info, location: SourceLocation.new(path: path, line: line, column: 1), message: "Executed line was not associated with an assertion subject.", suggestion: "Add an assertion that observes this behavior if it is semantically important." ) end result(score: (checked.checked_ratio * 100.0).round(2), findings: findings, confidence: :medium) end |