Class: RuboCop::Cop::Chef::RedundantCode::PropertySplatRegex
- Extended by:
 - AutoCorrector
 
- Includes:
 - RangeHelp
 
- Defined in:
 - lib/rubocop/cop/chef/redundant/property_splat_regex.rb
 
Overview
When a property has a type of String it can accept any string. There is no need to also validate string inputs against a regex that accept all values.
Constant Summary collapse
- MSG =
 'There is no need to validate the input of properties in resources using a regex value that will always pass.'- RESTRICT_ON_SEND =
 [:property, :attribute].freeze
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#on_send(node) ⇒ Object
      45 46 47 48 49 50 51 52 53 54  | 
    
      # File 'lib/rubocop/cop/chef/redundant/property_splat_regex.rb', line 45 def on_send(node) property_with_regex_splat?(node) do |splat| add_offense(splat, severity: :refactor) do |corrector| range = range_with_surrounding_comma( range_with_surrounding_space( range: splat.loc.expression, side: :left), :left) corrector.remove(range) end end end  |