Skip to content

Commit

Permalink
Merge pull request #10245 from chef/rubocop_Performance_RangeInclude
Browse files Browse the repository at this point in the history
Resolve Performance/RangeInclude warnings
  • Loading branch information
tas50 authored Aug 3, 2020
2 parents 8ed7a20 + 413632d commit 0e3e4ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/chef/resource/windows_firewall_rule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ def define_resource_requirements
requirements.assert(:create) do |a|
a.assertion do
if new_resource.icmp_type.is_a?(Integer)
(0..255).include?(new_resource.icmp_type)
(0..255).cover?(new_resource.icmp_type)
elsif new_resource.icmp_type.is_a?(String) && !new_resource.icmp_type.include?(":") && new_resource.protocol.start_with?("ICMP")
(0..255).include?(new_resource.icmp_type.to_i)
(0..255).cover?(new_resource.icmp_type.to_i)
elsif new_resource.icmp_type.is_a?(String) && new_resource.icmp_type.include?(":") && new_resource.protocol.start_with?("ICMP")
new_resource.icmp_type.split(":").all? { |type| (0..255).include?(type.to_i) }
new_resource.icmp_type.split(":").all? { |type| (0..255).cover?(type.to_i) }
else
true
end
Expand Down

0 comments on commit 0e3e4ba

Please sign in to comment.