diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-09-08 16:52:47 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-09-08 16:52:47 -0700 |
commit | aa5f3b9e9073139e598478932cb0102331b8c6f8 (patch) | |
tree | 474aabb86e81e571f06b950680922821bfd403a7 /lib/ohai | |
parent | 6fefe9971a84dcf5d8b3a0fcdce249d946e3f63e (diff) | |
download | ohai-aa5f3b9e9073139e598478932cb0102331b8c6f8.tar.gz |
Resolve RuboCop Style/RedundantParentheses warnings
Simplify the code so it's easier to read
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/ohai')
-rw-r--r-- | lib/ohai/mixin/do_metadata.rb | 2 | ||||
-rw-r--r-- | lib/ohai/mixin/scaleway_metadata.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/aix/memory.rb | 4 | ||||
-rw-r--r-- | lib/ohai/plugins/bsd/virtualization.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/cloud.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/cpu.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/darwin/platform.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/kernel.rb | 2 | ||||
-rw-r--r-- | lib/ohai/plugins/linux/network.rb | 4 |
9 files changed, 11 insertions, 11 deletions
diff --git a/lib/ohai/mixin/do_metadata.rb b/lib/ohai/mixin/do_metadata.rb index b23d2b58..b390b2ed 100644 --- a/lib/ohai/mixin/do_metadata.rb +++ b/lib/ohai/mixin/do_metadata.rb @@ -28,7 +28,7 @@ module Ohai end def fetch_metadata - uri = (DO_METADATA_URL).to_s + uri = DO_METADATA_URL.to_s response = http_client.get(uri) case response.code when "200" diff --git a/lib/ohai/mixin/scaleway_metadata.rb b/lib/ohai/mixin/scaleway_metadata.rb index 9b09f7d4..cef5beb6 100644 --- a/lib/ohai/mixin/scaleway_metadata.rb +++ b/lib/ohai/mixin/scaleway_metadata.rb @@ -32,7 +32,7 @@ module Ohai # # @return [Hash] def fetch_metadata - uri = (SCALEWAY_METADATA_URL).to_s + uri = SCALEWAY_METADATA_URL.to_s response = http_client.get(uri) case response.code when "200" diff --git a/lib/ohai/plugins/aix/memory.rb b/lib/ohai/plugins/aix/memory.rb index e209e14a..b4832a63 100644 --- a/lib/ohai/plugins/aix/memory.rb +++ b/lib/ohai/plugins/aix/memory.rb @@ -30,7 +30,7 @@ Ohai.plugin(:Memory) do memory[:free] = "#{free_in_mb.to_i * 1024}kB" swap_info = shell_out("swap -s").stdout.split # returns swap info in 4K blocks - memory[:swap]["total"] = "#{(swap_info[2].to_i) * 4}kB" - memory[:swap]["free"] = "#{(swap_info[10].to_i) * 4}kB" + memory[:swap]["total"] = "#{swap_info[2].to_i * 4}kB" + memory[:swap]["free"] = "#{swap_info[10].to_i * 4}kB" end end diff --git a/lib/ohai/plugins/bsd/virtualization.rb b/lib/ohai/plugins/bsd/virtualization.rb index f77ea704..f1f03ea2 100644 --- a/lib/ohai/plugins/bsd/virtualization.rb +++ b/lib/ohai/plugins/bsd/virtualization.rb @@ -49,7 +49,7 @@ Ohai.plugin(:Virtualization) do end # detect from modules - so = shell_out((Ohai.abs_path("/sbin/kldstat")).to_s) + so = shell_out(Ohai.abs_path("/sbin/kldstat").to_s) so.stdout.lines do |line| case line when /vboxdrv/ diff --git a/lib/ohai/plugins/cloud.rb b/lib/ohai/plugins/cloud.rb index d6df2571..9570b712 100644 --- a/lib/ohai/plugins/cloud.rb +++ b/lib/ohai/plugins/cloud.rb @@ -100,7 +100,7 @@ Ohai.plugin(:Cloud) do @cloud[:local_ipv6] = @cloud[:local_ipv6_addrs][0] if @cloud[:local_ipv6_addrs] # if empty, return nil - (@cloud.empty?) ? nil : @cloud + @cloud.empty? ? nil : @cloud end private diff --git a/lib/ohai/plugins/cpu.rb b/lib/ohai/plugins/cpu.rb index c7f56ff9..927dc173 100644 --- a/lib/ohai/plugins/cpu.rb +++ b/lib/ohai/plugins/cpu.rb @@ -61,7 +61,7 @@ Ohai.plugin(:CPU) do cpu_number += 1 when /vendor_id\s+:\s(.+)/ vendor_id = $1 - if vendor_id =~ (%r{IBM/S390}) + if vendor_id =~ %r{IBM/S390} cpuinfo["vendor_id"] = vendor_id else cpuinfo[current_cpu]["vendor_id"] = vendor_id diff --git a/lib/ohai/plugins/darwin/platform.rb b/lib/ohai/plugins/darwin/platform.rb index 439588f5..c744ad53 100644 --- a/lib/ohai/plugins/darwin/platform.rb +++ b/lib/ohai/plugins/darwin/platform.rb @@ -20,7 +20,7 @@ Ohai.plugin(:Platform) do provides "platform", "platform_version", "platform_build", "platform_family" collect_data(:darwin) do - so = shell_out((Ohai.abs_path( "/usr/bin/sw_vers" )).to_s) + so = shell_out(Ohai.abs_path( "/usr/bin/sw_vers" ).to_s) so.stdout.lines do |line| case line when /^ProductVersion:\s+(.+)$/ diff --git a/lib/ohai/plugins/kernel.rb b/lib/ohai/plugins/kernel.rb index 826d5a13..6fdfc1fd 100644 --- a/lib/ohai/plugins/kernel.rb +++ b/lib/ohai/plugins/kernel.rb @@ -42,7 +42,7 @@ Ohai.plugin(:Kernel) do # @return [Mash] def bsd_modules(path) modules = Mash.new - so = shell_out((Ohai.abs_path(path)).to_s) + so = shell_out(Ohai.abs_path(path).to_s) so.stdout.lines do |line| # 1 7 0xc0400000 97f830 kernel if line =~ /(\d+)\s+(\d+)\s+([0-9a-fx]+)\s+([0-9a-fx]+)\s+([a-zA-Z0-9\_]+)/ diff --git a/lib/ohai/plugins/linux/network.rb b/lib/ohai/plugins/linux/network.rb index 1f8b8693..f5008be0 100644 --- a/lib/ohai/plugins/linux/network.rb +++ b/lib/ohai/plugins/linux/network.rb @@ -264,7 +264,7 @@ Ohai.plugin(:Network) do end key, val = line.split(/:\s+/) if val - coalesce_key = "#{key.downcase.tr(" ", "_")}" + coalesce_key = key.downcase.tr(" ", "_").to_s iface[tmp_int]["coalesce_params"][coalesce_key] = val.to_i end end @@ -289,7 +289,7 @@ Ohai.plugin(:Network) do if val.nil? val = "" end - driver_key = "#{key.downcase.tr(" ", "_")}" + driver_key = key.downcase.tr(" ", "_").to_s iface[tmp_int]["driver_info"][driver_key] = val.chomp end end |