Skip to content

Commit a4ef8fe

Browse files
thomasrileymajormoses
authored andcommitted
Increase rubocop version to 0.51.x & remove Ruby 2.0 testing (#15)
* Increase rubocop version to 0.51+ & remove Ruby 2.0 testing * Rubocop fixes * TODO on the github comment: * Better use of rubocop:disable * remove extra disabled and made easier to read * appease cop about encoding on new check
1 parent d5e0161 commit a4ef8fe

14 files changed

+24
-19
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ mkmf.log
1616
.DS_Store
1717
.idea/*
1818
*.gem
19+
/vendor/

.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ cache:
44
install:
55
- bundle install
66
rvm:
7-
- 2.0
87
- 2.1
98
- 2.2
109
- 2.3.0
@@ -27,7 +26,6 @@ deploy:
2726
on:
2827
tags: true
2928
all_branches: true
30-
rvm: 2.0
3129
rvm: 2.1
3230
rvm: 2.2
3331
rvm: 2.3.0

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ This CHANGELOG follows the format listed at [Our CHANGELOG Guidelines ](https://
55
Which is based on [Keep A Changelog](http://keepachangelog.com/)
66

77
## [Unreleased]
8+
### Security
9+
- updated rubocop dependency to `~> 0.51.0` per: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8418. (@thomasriley)
10+
11+
### Breaking Changes
12+
- removed < ruby 2.1 support which was pulled as part of security updates (@thomasriley)
13+
14+
### Changed
15+
- Various amendments to comply with Rubocop (@thomasriley)
816

917
## [1.5.0] - 2017-12-06
1018
### Added

Rakefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ require 'yard'
77
require 'yard/rake/yardoc_task'
88

99
YARD::Rake::YardocTask.new do |t|
10-
OTHER_PATHS = %w().freeze
10+
OTHER_PATHS = %w[].freeze
1111
t.files = ['lib/**/*.rb', 'bin/**/*.rb', OTHER_PATHS]
12-
t.options = %w(--markup-provider=redcarpet --markup=markdown --main=README.md --files CHANGELOG.md)
12+
t.options = %w[--markup-provider=redcarpet --markup=markdown --main=README.md --files CHANGELOG.md]
1313
end
1414

1515
RuboCop::RakeTask.new
@@ -35,4 +35,4 @@ task :check_binstubs do
3535
end
3636
end
3737

38-
task default: [:spec, :make_bin_executable, :yard, :rubocop, :check_binstubs]
38+
task default: %i[spec make_bin_executable yard rubocop check_binstubs]

bin/check-netty-zookeeper-cluster.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env ruby
2-
# encoding: UTF-8
32

43
#
54
# netty-check-zookeeper-cluster

bin/check-znode.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#! /usr/bin/env ruby
2-
# encoding: UTF-8
32
#
43
# check-znode
54
#

bin/check-zookeeper-cluster.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env ruby
2-
# encoding: UTF-8
32
#
43
# check-zookeeper-cluster
54
#

bin/check-zookeeper-file-descriptors.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env ruby
2-
# encoding: UTF-8
32
#
43
# check-zookeeper-file-descriptors.rb
54
#

bin/check-zookeeper-latency.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env ruby
2-
# encoding: UTF-8
32
#
43
# check-zookeeper-latency
54
#

bin/check-zookeeper-mode.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env ruby
2-
# encoding: UTF-8
32
#
43
# check-zookeeper-mode
54
#

bin/check-zookeeper-reqs.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env ruby
2-
# encoding: UTF-8
32
#
43
# check-zookeeper-reqs
54
#

bin/check-zookeeper-ruok.rb

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env ruby
2-
# encoding: UTF-8
32
#
43
# check-zookeeper-ruok
54
#

bin/metrics-zookeeper-cluster.rb

+8-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ class ZookeeperMetrics < Sensu::Plugin::Metric::CLI::Graphite
4949
default: 2181,
5050
proc: proc(&:to_i)
5151

52-
def follow_url(uri_str, agent = "sensu-plugins-zookeeper/#{SensuPluginsZookeeper::Version::VER_STRING}", max_attempts = 10, timeout = 10)
52+
def follow_url(uri_str,
53+
agent = "sensu-plugins-zookeeper/#{SensuPluginsZookeeper::Version::VER_STRING}",
54+
max_attempts = 10,
55+
timeout = 10)
5356
attempts = 0
5457
cookie = nil
5558

@@ -95,6 +98,7 @@ def follow_url(uri_str, agent = "sensu-plugins-zookeeper/#{SensuPluginsZookeeper
9598

9699
response
97100
end
101+
# rubocop:enable Style/CommentedKeyword
98102

99103
def dotted(*args)
100104
args.join('.')
@@ -119,7 +123,9 @@ def run
119123
timestamp = Time.now.to_i
120124

121125
json = exhibitor_status
122-
json.each do |zk|
126+
127+
# TODO: Need to shortern this function
128+
json.each do |zk| # rubocop:disable Metrics/BlockLength
123129
hostname = zk['hostname']
124130
response = zk_command(:mntr, hostname, config[:zk_port])
125131
metrics = {}

sensu-plugins-zookeeper.gemspec

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
44
require 'date'
55
require_relative 'lib/sensu-plugins-zookeeper'
66

7-
Gem::Specification.new do |s|
7+
Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
88
s.authors = ['Sensu Plugins and contributors']
99

1010
s.date = Date.today.to_s
1111
s.description = 'Zookeeper plugins for checks and metrics'
1212
s.email = '<[email protected]>'
1313
s.executables = Dir.glob('bin/**/*.rb').map { |file| File.basename(file) }
14-
s.files = Dir.glob('{bin,lib}/**/*') + %w(LICENSE README.md CHANGELOG.md)
14+
s.files = Dir.glob('{bin,lib}/**/*') + %w[LICENSE README.md CHANGELOG.md]
1515
s.homepage = 'https://github.com/sensu-plugins/sensu-plugins-zookeeper'
1616
s.license = 'MIT'
1717
s.metadata = { 'maintainer' => 'sensu-plugin',
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
2121
s.platform = Gem::Platform::RUBY
2222
s.post_install_message = 'You can use the embedded Ruby by setting EMBEDDED_RUBY=true in /etc/default/sensu'
2323
s.require_paths = ['lib']
24-
s.required_ruby_version = '>= 2.0.0'
24+
s.required_ruby_version = '>= 2.1.0'
2525

2626
s.summary = 'Sensu plugins for zookeeper'
2727
s.test_files = s.files.grep(%r{^(test|spec|features)/})
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
3636
s.add_development_dependency 'pry', '~> 0.10'
3737
s.add_development_dependency 'rake', '~> 10.5'
3838
s.add_development_dependency 'redcarpet', '~> 3.2'
39-
s.add_development_dependency 'rubocop', '~> 0.40.0'
4039
s.add_development_dependency 'rspec', '~> 3.4'
40+
s.add_development_dependency 'rubocop', '~> 0.51.0'
4141
s.add_development_dependency 'yard', '~> 0.8'
4242
end

0 commit comments

Comments
 (0)