Class: RuboCop::Cop::Chef::Deprecations::ChefSpecCoverageReport

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Defined in:
lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb

Overview

Don’t use the deprecated ChefSpec Coverage report functionality in your specs. This feature has been removed as coverage reports encourage cookbook authors to write ineffective specs. Focus on testing your logic instead of achieving 100% code coverage.

Examples:


### incorrect

at_exit { ChefSpec::Coverage.report! }

Constant Summary collapse

MSG =
"Don't use the deprecated ChefSpec coverage report functionality in your specs."

Instance Method Summary collapse

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_block(node) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/rubocop/cop/chef/deprecation/chefspec_coverage_report.rb', line 38

def on_block(node)
  coverage_reporter?(node) do
    add_offense(node, severity: :warning) do |corrector|
      corrector.remove(node)
    end
  end
end