Class: RuboCop::Cop::Chef::Modernize::DefinesChefSpecMatchers
- Extended by:
- AutoCorrector
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb
Overview
ChefSpec 7.1 and later auto generate ChefSpec matchers. Matchers in cookbooks can now be removed.
Constant Summary collapse
- MSG =
'ChefSpec matchers are now auto generated by ChefSpec 7.1+ and do not need to be defined in a cookbook'
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#on_if(node) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/rubocop/cop/chef/modernize/defines_chefspec_matchers.rb', line 43 def on_if(node) chefspec_matcher?(node) do add_offense(node, severity: :refactor) do |corrector| corrector.remove(range_with_surrounding_space(range: node.loc.expression, side: :left)) end end end |