From 5a6ffc7e2df076c266c322ae9272b098b3ab40ed Mon Sep 17 00:00:00 2001 From: Michael Herold Date: Sat, 3 Feb 2018 10:23:14 -0600 Subject: Update Rubocop and address the addressable todos This is a big step forward in our Rubocop setup. I addressed all of the todos from the current version of Rubocop that made sense to. The only things that remain are metrics and one cop that relies on the line length metric to work. I made some judgment calls on disabling a few cops: 1. The `Layout/IndentHeredoc` cop wants you to either use the squiggly heredoc from Ruby 2.3 or introduce a library. Since we are a low-level library that is used as a transitive dependency, we cannot introduce another library as a dependence, so that option is out. Also, we support Rubies back to 2.0 currently, so using the squiggly heredoc isn't an option. Once we remove support for Rubies older than 2.3, we can switch to the squiggly heredoc cop. 2. The `Naming/FileName` cop was reporting false positives for a few files in the repository, so I disabled it on those files. 3. The `Style/DoubleNegation` cop reports lints on a few cases where we use double negation. Given the very generic nature of Hashie, the double-negation is the easiest, clearest way to express that we want an item to be a Boolean. I disabled the cop because we exist in the gray area where this makes sense. --- lib/hashie/rash.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/hashie/rash.rb') diff --git a/lib/hashie/rash.rb b/lib/hashie/rash.rb index 0024eee..a7fce10 100644 --- a/lib/hashie/rash.rb +++ b/lib/hashie/rash.rb @@ -64,7 +64,7 @@ module Hashie # Raise (or yield) unless something matches the key. # def fetch(*args) - fail ArgumentError, "Expected 1-2 arguments, got #{args.length}" \ + raise ArgumentError, "Expected 1-2 arguments, got #{args.length}" \ unless (1..2).cover?(args.length) key, default = args @@ -78,7 +78,7 @@ module Hashie elsif default default else - fail KeyError, "key not found: #{key.inspect}" + raise KeyError, "key not found: #{key.inspect}" end end @@ -125,11 +125,11 @@ module Hashie end def method_missing(*args, &block) - @hash.send(*args, &block) + @hash.send(*args, &block) || super end - def respond_to_missing?(*args) - @hash.respond_to?(*args) + def respond_to_missing?(method_name, _include_private = false) + @hash.respond_to?(method_name) end private -- cgit v1.2.1