Skip to content

Commit 39c3b5b

Browse files
author
Jef Spaleta
authored
Merge pull request #117 from sensu-plugins/dependabot/bundler/rubocop-tw-0.79.0
Update rubocop requirement from ~> 0.49.0 to ~> 0.79.0
2 parents 696a392 + 3e48659 commit 39c3b5b

21 files changed

+89
-46
lines changed

.rubocop.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
AllCops:
2+
TargetRubyVersion: 2.4
13

24
MethodLength:
35
Max: 200

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

35
# Specify your gem's dependencies in sensu-plugins-postgres.gemspec

Rakefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'bundler/gem_tasks'
24
require 'github/markup'
35
require 'redcarpet'
@@ -29,7 +31,7 @@ desc 'Test for binstubs'
2931
task :check_binstubs do
3032
bin_list = Gem::Specification.load('sensu-plugins-postgres.gemspec').executables
3133
bin_list.each do |b|
32-
`which #{ b }`
34+
`which #{b}`
3335
unless $CHILD_STATUS.success?
3436
puts "#{b} was not a binstub"
3537
exit

bin/check-postgres-alive.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# check-postgres-alive
46
#
@@ -86,6 +88,6 @@ def run
8688
rescue PG::Error => e
8789
critical "Error message: #{e.error.split("\n").first}"
8890
ensure
89-
con.close if con
91+
con&.close
9092
end
9193
end

bin/check-postgres-connections.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# check-postgres-connections
46
#
@@ -114,7 +116,7 @@ def run
114116
unknown "Unable to query PostgreSQL: #{e.message}"
115117
end
116118

117-
percent = (current_conns.to_f / max_conns.to_f * 100).to_i
119+
percent = (current_conns / max_conns.to_f * 100).to_i
118120

119121
if config[:use_percentage]
120122
message = "PostgreSQL connections at #{percent}%, #{current_conns} out of #{available_conns} connections"

bin/check-postgres-query.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# check-postgres-query
46
#

bin/check-postgres-replication.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# check-postgres-replication
46
#

bin/metric-postgres-connections.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# metric-postgres-connections
46
#
@@ -81,12 +83,12 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
8183
def run
8284
timestamp = Time.now.to_i
8385
pgpass
84-
con = PG.connect(host: config[:hostname],
85-
dbname: config[:database],
86-
user: config[:user],
87-
password: config[:password],
88-
port: config[:port],
89-
connect_timeout: config[:timeout])
86+
con = PG.connect(host: config[:hostname],
87+
dbname: config[:database],
88+
user: config[:user],
89+
password: config[:password],
90+
port: config[:port],
91+
connect_timeout: config[:timeout])
9092
request = [
9193
"select case when count(*) = 1 then 'waiting' else",
9294
"'case when wait_event_type is null then false else true end' end as wait_col",

bin/metric-postgres-dbsize.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# metric-postgres-dbsize
46
#
@@ -81,12 +83,12 @@ class PostgresStatsDBMetrics < Sensu::Plugin::Metric::CLI::Graphite
8183
def run
8284
timestamp = Time.now.to_i
8385
pgpass
84-
con = PG.connect(host: config[:hostname],
85-
dbname: config[:database],
86-
user: config[:user],
87-
password: config[:password],
88-
port: config[:port],
89-
connect_timeout: config[:timeout])
86+
con = PG.connect(host: config[:hostname],
87+
dbname: config[:database],
88+
user: config[:user],
89+
password: config[:password],
90+
port: config[:port],
91+
connect_timeout: config[:timeout])
9092
request = [
9193
"select pg_database_size('#{config[:database]}')"
9294
]

bin/metric-postgres-graphite.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! /usr/bin/env ruby
2+
# frozen_string_literal: true
3+
24
#
35
# metric-postgres-graphite
46
#

0 commit comments

Comments
 (0)