Skip to content

Commit 2e188f3

Browse files
committed
Fix Rubocop Performance/StringInclude offenses
Similar to the work in ed14bbd, this commit updates instances of !~ to instead negate String#include?. The Performance/StringInclude began identifying this pattern in rubocop-performance 1.15.2.
1 parent 2c00dfb commit 2e188f3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/puppet/type/host.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def valid_v6?(addr)
2323
end
2424

2525
def valid_newline?(addr)
26-
addr !~ %r{\n} && addr !~ %r{\r}
26+
!addr.include?("\n") && !addr.include?("\r")
2727
end
2828

2929
validate do |value|

spec/spec_helper_acceptance.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
on(host, '/usr/sbin/svcadm restart /system/ca-certificates')
5252
timeout = 60
5353
counter = 0
54-
while on(host, 'svcs -x ca-certificates').output !~ %r{State: online}
54+
until on(host, 'svcs -x ca-certificates').output.include?('State: online')
5555
raise 'ca-certificates services failed start up' if counter > timeout
5656
sleep 5
5757
counter += 5

0 commit comments

Comments
 (0)