diff --git a/.rubocop.yml b/.rubocop.yml index 0ba1665..d9a2582 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -28,3 +28,8 @@ RegexpLiteral: Style/Documentation: Enabled: false + +# tests can be slow +Metrics/BlockLength: + Exclude: + - 'test/**/*' diff --git a/.travis.yml b/.travis.yml index 8ea9bcc..96b18b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,6 @@ before_install: install: - bundle install rvm: -- 2.0 - 2.1 - 2.2 - 2.3.0 @@ -33,7 +32,6 @@ deploy: on: tags: true all_branches: true - rvm: 2.0 rvm: 2.1 rvm: 2.2 rvm: 2.3.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 05f6190..2ee2dee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,18 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ## [Unreleased] +### Security +- updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@majormoses) + +### Breaking Changes +- removed ruby `< 2.1` support (@majormoses) + +### Changed +- appeased the cops (@majormoses) + ## [2.4.0] - 2018-03-14 ### Added - check-redis-connections-available.rb: checks the number of connections available (@nishiki) - ## [2.3.2] - 2017-12-21 ### Fixed - locked `development_dependency` of `mixlib-shellout` on to fix ruby 2.1 support (@majormoses) diff --git a/Rakefile b/Rakefile index c12095c..39cf7c5 100644 --- a/Rakefile +++ b/Rakefile @@ -8,9 +8,9 @@ require 'yard/rake/yardoc_task' require 'kitchen/rake_tasks' YARD::Rake::YardocTask.new do |t| - OTHER_PATHS = %w().freeze + OTHER_PATHS = %w[].freeze t.files = ['lib/**/*.rb', 'bin/**/*.rb', OTHER_PATHS] - t.options = %w(--markup-provider=redcarpet --markup=markdown --main=README.md --files CHANGELOG.md) + t.options = %w[--markup-provider=redcarpet --markup=markdown --main=README.md --files CHANGELOG.md] end RuboCop::RakeTask.new @@ -57,6 +57,6 @@ task :integration do threads.map(&:join) end -task default: %i(make_bin_executable yard rubocop check_binstubs integration) +task default: %i[make_bin_executable yard rubocop check_binstubs integration] -task quick: %i(make_bin_executable yard rubocop check_binstubs unit) +task quick: %i[make_bin_executable yard rubocop check_binstubs unit] diff --git a/bin/check-redis-connections-available.rb b/bin/check-redis-connections-available.rb index 2cf8e68..ff9bdd9 100755 --- a/bin/check-redis-connections-available.rb +++ b/bin/check-redis-connections-available.rb @@ -57,8 +57,7 @@ def run else ok "There are #{conn_available} connections available (#{clients}/#{maxclients})" end - - rescue + rescue StandardError send(config[:conn_failure_status], "Could not connect to Redis server on #{redis_endpoint}") end end diff --git a/bin/check-redis-info.rb b/bin/check-redis-info.rb index 7ad6ee3..1c96db8 100755 --- a/bin/check-redis-info.rb +++ b/bin/check-redis-info.rb @@ -45,7 +45,7 @@ def run else critical "Redis #{config[:redis_info_key]} is #{redis.info.fetch(config[:redis_info_key].to_s)}!" end - rescue + rescue StandardError send(config[:conn_failure_status], "Could not connect to Redis server on #{redis_endpoint}") end end diff --git a/bin/check-redis-keys.rb b/bin/check-redis-keys.rb index fbf0add..c6215ab 100755 --- a/bin/check-redis-keys.rb +++ b/bin/check-redis-keys.rb @@ -49,7 +49,7 @@ def run else ok "Redis list #{config[:pattern]} length is above thresholds" end - rescue + rescue StandardError send(config[:conn_failure_status], "Could not connect to Redis server on #{redis_endpoint}") end end diff --git a/bin/check-redis-list-length.rb b/bin/check-redis-list-length.rb index 495bc78..358ba63 100755 --- a/bin/check-redis-list-length.rb +++ b/bin/check-redis-list-length.rb @@ -57,7 +57,7 @@ def run else ok "Redis list #{config[:key]} length (#{length}) is below thresholds" end - rescue + rescue StandardError send(config[:conn_failure_status], "Could not connect to Redis server on #{redis_endpoint}") end end diff --git a/bin/check-redis-memory-percentage.rb b/bin/check-redis-memory-percentage.rb index e439a17..4d90259 100755 --- a/bin/check-redis-memory-percentage.rb +++ b/bin/check-redis-memory-percentage.rb @@ -57,7 +57,7 @@ def run redis_info = redis.info max_memory = redis_info.fetch('maxmemory', 0).to_i - if max_memory == 0 + if max_memory.zero? max_memory = redis_info.fetch('total_system_memory', system_memory).to_i end memory_in_use = redis_info.fetch('used_memory').to_i.fdiv(1024) # used memory in KB (KiloBytes) @@ -73,7 +73,7 @@ def run else ok "Redis memory usage: #{used_memory}% is below defined limits" end - rescue + rescue StandardError send(config[:conn_failure_status], "Could not connect to Redis server on #{redis_endpoint}") end end diff --git a/bin/check-redis-memory.rb b/bin/check-redis-memory.rb index 5d76ef8..8a9ebba 100755 --- a/bin/check-redis-memory.rb +++ b/bin/check-redis-memory.rb @@ -42,7 +42,7 @@ def run else ok "Redis memory usage: #{used_memory}KB is below defined limits" end - rescue + rescue StandardError send(config[:conn_failure_status], "Could not connect to Redis server on #{redis_endpoint}") end end diff --git a/bin/check-redis-ping.rb b/bin/check-redis-ping.rb index 25e5d47..3cf4db3 100755 --- a/bin/check-redis-ping.rb +++ b/bin/check-redis-ping.rb @@ -1,5 +1,5 @@ #! /usr/bin/env ruby -# encoding: UTF-8 + #