diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 365eed85..ce465061 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -13,11 +13,6 @@ Gemspec/RequiredRubyVersion: Exclude: - 'pry.gemspec' -# Offense count: 1 -Lint/ReturnInVoidContext: - Exclude: - - 'lib/pry/command_set.rb' - # Offense count: 1 Lint/ShadowedException: Exclude: diff --git a/lib/pry/command_set.rb b/lib/pry/command_set.rb index 9226cf6a..42bf512b 100644 --- a/lib/pry/command_set.rb +++ b/lib/pry/command_set.rb @@ -325,7 +325,11 @@ class Pry # Pry.config.commands["help"] = MyHelpCommand # def []=(pattern, command) - return @commands.delete(pattern) if command.equal?(nil) + if command.equal?(nil) + @commands.delete(pattern) + return + end + unless Class === command && command < Pry::Command raise TypeError, "command is not a subclass of Pry::Command" end