Class: RuboCop::Cop::InSpecStyle::ShadowProperties
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::InSpecStyle::ShadowProperties
- Includes:
- RangeHelp
- Defined in:
- lib/rubocop/cop/inspecstyle/shadow_properties.rb
Overview
Shadow resource properties `user|password|last_change|expiry_date|line` is deprecated in favor of `users|passwords|last_changes|expiry_dates|lines`
Constant Summary collapse
- MSG =
'Use `:%<violation>ss` instead of `:%<violation>s` as a property ' \ 'for the `shadow` resource. This property will be removed in InSpec 5'
Instance Method Summary collapse
Instance Method Details
#autocorrect(node) ⇒ Object
64 65 66 67 68 |
# File 'lib/rubocop/cop/inspecstyle/shadow_properties.rb', line 64 def autocorrect(node) lambda do |corrector| corrector.insert_after(offense_range(node), 's') end end |
#on_block(node) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rubocop/cop/inspecstyle/shadow_properties.rb', line 48 def on_block(node) return unless inside_shadow_spec?(node) node.descendants.each do |descendant| deprecated_shadow_property?(descendant) do |violation| add_offense( descendant, location: offense_range(descendant), message: format( MSG, violation: violation ) ) end end end |