class RuboCop::Cop::Chef::RedundantCode::PropertySplatRegex
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.
@example
### incorrect property :config_file, String, regex: /.*/ attribute :config_file, String, regex: /.*/ ### correct property :config_file, String attribute :config_file, String
Constants
- MSG
- RESTRICT_ON_SEND
Public Instance Methods
Source
# 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