Class: RuboCop::Cop::InSpecStyle::ShadowProperties
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::InSpecStyle::ShadowProperties
- Defined in:
- lib/rubocop/cop/inspecstyle/shadow_properties.rb
Overview
Shadow resource property user is deprecated in favor of ‘users`
Constant Summary collapse
- MSG =
TODO: Implement the cop in here.
In many cases, you can use a node matcher for matching node pattern. See github.com/rubocop-hq/rubocop-ast/blob/master/lib/rubocop/node_pattern.rb
For example
'Use `:%<modifier>ss` instead of `:%<modifier>s` as a property ' \ 'for the `shadow` resource. This property will be removed in InSpec 5'
Instance Method Summary collapse
Instance Method Details
#on_block(node) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/rubocop/cop/inspecstyle/shadow_properties.rb', line 45 def on_block(node) return unless shadow_resource_user_property?(node) do |modifier| = format(MSG, modifier: modifier) range = locate_range(modifier, node) add_offense(node, message: , location: range) end end |