Skip to content

Commit

Permalink
[CVE-2017-8418] - updating rubocop dependency.
Browse files Browse the repository at this point in the history
Misc:
- apeased cops

Signed-off-by: Ben Abrams <me@benabrams.it>
  • Loading branch information
majormoses committed Mar 5, 2018
1 parent c99297b commit c1efacd
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,12 @@ This CHANGELOG follows the located [here](https://github.com/sensu-plugins/commu

## [Unreleased]

### Security
- updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@majormoses)

### Changed
- appeased the cops (@majormoses)

## [3.1.1] - 2017-10-25
### Fixed
- check-memory-percent.sh: compare variable `$os` rather than the string 'os' (@lcc207)
Expand Down
6 changes: 3 additions & 3 deletions Rakefile
Expand Up @@ -7,9 +7,9 @@ require 'yard'
require 'yard/rake/yardoc_task'

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
Expand All @@ -35,4 +35,4 @@ task :check_binstubs do
end
end

task default: [:spec, :make_bin_executable, :yard, :rubocop, :check_binstubs]
task default: %i[spec make_bin_executable yard rubocop check_binstubs]
2 changes: 1 addition & 1 deletion bin/check-memory-percent.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby

bin_dir = File.expand_path(File.dirname(__FILE__))
bin_dir = File.expand_path(__dir__)
shell_script_path = File.join(bin_dir, File.basename($PROGRAM_NAME, '.rb') + '.sh')

exec shell_script_path, *ARGV, unsetenv_others: true
2 changes: 1 addition & 1 deletion bin/check-memory.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby

bin_dir = File.expand_path(File.dirname(__FILE__))
bin_dir = File.expand_path(__dir__)
shell_script_path = File.join(bin_dir, File.basename($PROGRAM_NAME, '.rb') + '.sh')

exec shell_script_path, *ARGV, unsetenv_others: true
4 changes: 2 additions & 2 deletions bin/check-ram.rb
@@ -1,5 +1,4 @@
#! /usr/bin/env ruby
# encoding: UTF-8
#
# check-ram
#
Expand Down Expand Up @@ -94,7 +93,8 @@ def run
# free_ram is returned in Bytes. see: https://github.com/threez/ruby-vmstat/blob/master/lib/vmstat/memory.rb
free_ram /= 1024 * 1024
used_ram /= 1024 * 1024
total_ram /= 1024 * 1024
# false positive
total_ram /= 1024 * 1024 # rubocop:disable Lint/UselessAssignment
if config[:free]
ram = free_ram
message "#{ram} megabytes of RAM left"
Expand Down
1 change: 0 additions & 1 deletion bin/check-swap-percent.rb
@@ -1,5 +1,4 @@
#! /usr/bin/env ruby
# encoding: UTF-8
#
# Checks SWAP usage as a % of the total swap
#
Expand Down
2 changes: 1 addition & 1 deletion bin/check-swap.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby

bin_dir = File.expand_path(File.dirname(__FILE__))
bin_dir = File.expand_path(__dir__)
shell_script_path = File.join(bin_dir, File.basename($PROGRAM_NAME, '.rb') + '.sh')

exec shell_script_path, *ARGV
2 changes: 1 addition & 1 deletion bin/check-swap.sh
Expand Up @@ -17,7 +17,7 @@ LANG=C

# get arguments

# #RED
# #RED
while getopts 'w:c:hp' OPT; do
case $OPT in
w) WARN=$OPTARG;;
Expand Down
3 changes: 1 addition & 2 deletions bin/metrics-memory-percent.rb
@@ -1,5 +1,4 @@
#! /usr/bin/env ruby
# encoding: UTF-8
#
# metrics-memory-percent
#
Expand Down Expand Up @@ -80,7 +79,7 @@ def metrics_hash
mem['swapTotal']
end

mem.each do |k, _v|
mem.each_key do |k|
# with percentages, used and free are exactly complementary
# no need to have both
# the one to drop here is "used" because "free" will
Expand Down
1 change: 0 additions & 1 deletion bin/metrics-memory.rb
@@ -1,5 +1,4 @@
#! /usr/bin/env ruby
# encoding: UTF-8
#
# metrics-memory
#
Expand Down
6 changes: 3 additions & 3 deletions sensu-plugins-memory-checks.gemspec
Expand Up @@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'date'
require_relative 'lib/sensu-plugins-memory-checks'

Gem::Specification.new do |s|
Gem::Specification.new do |s| # rubocop: disable Metrics/BlockLength
s.authors = ['Sensu Plugins and contributors']
s.date = Date.today.to_s
s.description = 'This plugin provides native memory instrumentation
Expand All @@ -13,7 +13,7 @@ Gem::Specification.new do |s|
Note that this plugin may have cross-platform issues.'
s.email = '<sensu-users@googlegroups.com>'
s.executables = Dir.glob('bin/**/*.rb').map { |file| File.basename(file) }
s.files = Dir.glob('{bin,lib}/**/*') + %w(LICENSE README.md CHANGELOG.md)
s.files = Dir.glob('{bin,lib}/**/*') + %w[LICENSE README.md CHANGELOG.md]
s.homepage = 'https://github.com/sensu-plugins/sensu-plugins-memory-checks'
s.license = 'MIT'
s.metadata = { 'maintainer' => 'sensu-plugin',
Expand All @@ -38,8 +38,8 @@ Gem::Specification.new do |s|
s.add_development_dependency 'pry', '~> 0.10'
s.add_development_dependency 'rake', '~> 10.5'
s.add_development_dependency 'redcarpet', '~> 3.2'
s.add_development_dependency 'rubocop', '~> 0.40.0'
s.add_development_dependency 'rspec', '~> 3.4'
s.add_development_dependency 'rubocop', '~> 0.51.0'
s.add_development_dependency 'vmstat', '~> 2.3.0'
s.add_development_dependency 'yard', '~> 0.8'
end

0 comments on commit c1efacd

Please sign in to comment.