From f3a354649288e302ab06f00e46a6264cd54056d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Sun, 21 Jan 2024 08:55:58 -1000 Subject: [PATCH] Correct Style/RedundantRegexpArgument offenses --- lib/riemann/tools.rb | 2 +- lib/riemann/tools/diskstats.rb | 2 +- lib/riemann/tools/health.rb | 2 +- tools/riemann-docker/lib/riemann/tools/docker.rb | 2 +- tools/riemann-riak/lib/riemann/tools/riak.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/riemann/tools.rb b/lib/riemann/tools.rb index c7574461..a5549698 100644 --- a/lib/riemann/tools.rb +++ b/lib/riemann/tools.rb @@ -52,7 +52,7 @@ def options def attributes @attributes ||= Hash[options[:attribute].map do |attr| - k, v = attr.split(/=/) + k, v = attr.split('=') [k, v] if k && v end] end diff --git a/lib/riemann/tools/diskstats.rb b/lib/riemann/tools/diskstats.rb index 5de1c2ab..9fb42ee3 100644 --- a/lib/riemann/tools/diskstats.rb +++ b/lib/riemann/tools/diskstats.rb @@ -80,7 +80,7 @@ def tick next unless service =~ /io time$/ report( - service: "diskstats #{service.gsub(/time/, 'util')}", + service: "diskstats #{service.gsub('time', 'util')}", metric: (delta.to_f / (opts[:interval] * 1000)), state: 'ok', ) diff --git a/lib/riemann/tools/health.rb b/lib/riemann/tools/health.rb index 3d4ab54f..a9f59a06 100644 --- a/lib/riemann/tools/health.rb +++ b/lib/riemann/tools/health.rb @@ -188,7 +188,7 @@ def linux_load end def linux_memory - m = File.read('/proc/meminfo').split(/\n/).each_with_object({}) do |line, info| + m = File.read('/proc/meminfo').split("\n").each_with_object({}) do |line, info| x = line.split(/:?\s+/) # Assume kB... info[x[0]] = x[1].to_i diff --git a/tools/riemann-docker/lib/riemann/tools/docker.rb b/tools/riemann-docker/lib/riemann/tools/docker.rb index 51fcfc43..a20163b2 100644 --- a/tools/riemann-docker/lib/riemann/tools/docker.rb +++ b/tools/riemann-docker/lib/riemann/tools/docker.rb @@ -121,7 +121,7 @@ def memory(_id, name, stats) end def disk - `df -P`.split(/\n/).each do |r| + `df -P`.split("\n").each do |r| f = r.split(/\s+/) next if f[0] == 'Filesystem' next unless f[0] =~ %r{/} # Needs at least one slash in the mount path diff --git a/tools/riemann-riak/lib/riemann/tools/riak.rb b/tools/riemann-riak/lib/riemann/tools/riak.rb index 182efcd9..fe253cf8 100644 --- a/tools/riemann-riak/lib/riemann/tools/riak.rb +++ b/tools/riemann-riak/lib/riemann/tools/riak.rb @@ -201,7 +201,7 @@ def stats_riak_admin str = `riak-admin status` raise 'riak-admin failed' unless $CHILD_STATUS == 0 - Hash[str.split(/\n/).map { |i| i.split(/ : /) }] + Hash[str.split("\n").map { |i| i.split(' : ') }] end # Get current stats as a hash