summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-09-08 12:07:49 -0700
committerTim Smith <tsmith84@gmail.com>2020-09-08 12:07:49 -0700
commit5fd33555791c3372948f5c130faadcd8dbfeb9aa (patch)
tree84ab75e2f528821787237d8cd831acee66b8f563
parentb624c5a1622a130dcb7c9432aa4f6971af456914 (diff)
downloadohai-5fd33555791c3372948f5c130faadcd8dbfeb9aa.tar.gz
Updates for the new perf cops
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--.rubocop.yml4
-rw-r--r--lib/ohai/plugins/linode.rb2
-rw-r--r--spec/support/platform_helpers.rb6
3 files changed, 8 insertions, 4 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index 425a9e8c..9f82e5e8 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,6 +1,7 @@
require: rubocop-performance
AllCops:
+ NewCops: enable
TargetRubyVersion: 2.5
Exclude:
- "spec/data/**/*"
@@ -14,4 +15,7 @@ Layout/IndentationStyle:
- "lib/ohai/plugins/darwin/hardware.rb"
Performance/Caller:
+ Enabled: false
+
+Performance/CollectionLiteralInLoop:
Enabled: false \ No newline at end of file
diff --git a/lib/ohai/plugins/linode.rb b/lib/ohai/plugins/linode.rb
index 64e8a62f..735134ce 100644
--- a/lib/ohai/plugins/linode.rb
+++ b/lib/ohai/plugins/linode.rb
@@ -25,7 +25,7 @@ Ohai.plugin(:Linode) do
# Returns true or false
def has_linode_kernel?
if ( kernel_data = kernel )
- kernel_data[:release].split("-").last =~ /linode/
+ kernel_data[:release].split("-").last.include?('linode')
end
end
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index 2a531883..eaf8bc00 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -24,15 +24,15 @@ def unix?
end
def os_x?
- !!(RUBY_PLATFORM =~ /darwin/)
+ RUBY_PLATFORM.include?('darwin')
end
def solaris?
- !!(RUBY_PLATFORM =~ /solaris/)
+ RUBY_PLATFORM.include?('solaris')
end
def freebsd?
- !!(RUBY_PLATFORM =~ /freebsd/)
+ RUBY_PLATFORM.include?('freebsd')
end
DEV_NULL = windows? ? "NUL" : "/dev/null"