Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase rubocop version to 0.51.x & remove Ruby 2.0 testing #15

Merged
merged 6 commits into from
Jan 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ mkmf.log
.DS_Store
.idea/*
*.gem
/vendor/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably better to use vendor/* as this will catch anything with vendor in its name (not that I can think of a great real use case that this blocks).

2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ cache:
install:
- bundle install
rvm:
- 2.0
- 2.1
- 2.2
- 2.3.0
Expand All @@ -27,7 +26,6 @@ deploy:
on:
tags: true
all_branches: true
rvm: 2.0
rvm: 2.1
rvm: 2.2
rvm: 2.3.0
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ This CHANGELOG follows the format listed at [Our CHANGELOG Guidelines ](https://
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. (@thomasriley)

### Breaking Changes
- removed < ruby 2.1 support which was pulled as part of security updates (@thomasriley)

### Changed
- Various amendments to comply with Rubocop (@thomasriley)

## [1.5.0] - 2017-12-06
### Added
Expand Down
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
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]
1 change: 0 additions & 1 deletion bin/check-netty-zookeeper-cluster.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
# encoding: UTF-8

#
# netty-check-zookeeper-cluster
Expand Down
1 change: 0 additions & 1 deletion bin/check-znode.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#! /usr/bin/env ruby
# encoding: UTF-8
#
# check-znode
#
Expand Down
1 change: 0 additions & 1 deletion bin/check-zookeeper-cluster.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
# encoding: UTF-8
#
# check-zookeeper-cluster
#
Expand Down
1 change: 0 additions & 1 deletion bin/check-zookeeper-file-descriptors.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
# encoding: UTF-8
#
# check-zookeeper-file-descriptors.rb
#
Expand Down
1 change: 0 additions & 1 deletion bin/check-zookeeper-latency.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
# encoding: UTF-8
#
# check-zookeeper-latency
#
Expand Down
1 change: 0 additions & 1 deletion bin/check-zookeeper-mode.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
# encoding: UTF-8
#
# check-zookeeper-mode
#
Expand Down
1 change: 0 additions & 1 deletion bin/check-zookeeper-reqs.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
# encoding: UTF-8
#
# check-zookeeper-reqs
#
Expand Down
1 change: 0 additions & 1 deletion bin/check-zookeeper-ruok.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
# encoding: UTF-8
#
# check-zookeeper-ruok
#
Expand Down
10 changes: 8 additions & 2 deletions bin/metrics-zookeeper-cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ class ZookeeperMetrics < Sensu::Plugin::Metric::CLI::Graphite
default: 2181,
proc: proc(&:to_i)

def follow_url(uri_str, agent = "sensu-plugins-zookeeper/#{SensuPluginsZookeeper::Version::VER_STRING}", max_attempts = 10, timeout = 10)
def follow_url(uri_str,
agent = "sensu-plugins-zookeeper/#{SensuPluginsZookeeper::Version::VER_STRING}",
max_attempts = 10,
timeout = 10)
attempts = 0
cookie = nil

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

response
end
# rubocop:enable Style/CommentedKeyword

def dotted(*args)
args.join('.')
Expand All @@ -119,7 +123,9 @@ def run
timestamp = Time.now.to_i

json = exhibitor_status
json.each do |zk|

# TODO: Need to shortern this function
json.each do |zk| # rubocop:disable Metrics/BlockLength
hostname = zk['hostname']
response = zk_command(:mntr, hostname, config[:zk_port])
metrics = {}
Expand Down
8 changes: 4 additions & 4 deletions sensu-plugins-zookeeper.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'date'
require_relative 'lib/sensu-plugins-zookeeper'

Gem::Specification.new do |s|
Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

s.authors = ['Sensu Plugins and contributors']

s.date = Date.today.to_s
s.description = 'Zookeeper plugins for checks and metrics'
s.email = '<[email protected]>'
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-zookeeper'
s.license = 'MIT'
s.metadata = { 'maintainer' => 'sensu-plugin',
Expand All @@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.post_install_message = 'You can use the embedded Ruby by setting EMBEDDED_RUBY=true in /etc/default/sensu'
s.require_paths = ['lib']
s.required_ruby_version = '>= 2.0.0'
s.required_ruby_version = '>= 2.1.0'

s.summary = 'Sensu plugins for zookeeper'
s.test_files = s.files.grep(%r{^(test|spec|features)/})
Expand All @@ -36,7 +36,7 @@ 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 'yard', '~> 0.8'
end