From c0328707b12c9ceffd6f39d1bfaf73d0dbe056bb Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Fri, 2 Aug 2019 13:47:54 -0300 Subject: [PATCH] style: enable Style/ParallelAssignment cop checks --- .rubocop.yml | 3 +++ lib/rack/attack.rb | 5 ++++- lib/rack/attack/check.rb | 3 ++- lib/rack/attack/throttle.rb | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ef0f722..c38c69a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -67,6 +67,9 @@ Style/HashSyntax: Style/OptionalArguments: Enabled: true +Style/ParallelAssignment: + Enabled: true + Style/RaiseArgs: Enabled: true diff --git a/lib/rack/attack.rb b/lib/rack/attack.rb index 88e0fad..f875033 100644 --- a/lib/rack/attack.rb +++ b/lib/rack/attack.rb @@ -119,7 +119,10 @@ module Rack end def clear_configuration - @safelists, @blocklists, @throttles, @tracks = {}, {}, {}, {} + @safelists = {} + @blocklists = {} + @throttles = {} + @tracks = {} self.anonymous_blocklists = [] self.anonymous_safelists = [] end diff --git a/lib/rack/attack/check.rb b/lib/rack/attack/check.rb index ef4ad78..4c985eb 100644 --- a/lib/rack/attack/check.rb +++ b/lib/rack/attack/check.rb @@ -5,7 +5,8 @@ module Rack class Check attr_reader :name, :block, :type def initialize(name, options = {}, &block) - @name, @block = name, block + @name = name + @block = block @type = options.fetch(:type, nil) end diff --git a/lib/rack/attack/throttle.rb b/lib/rack/attack/throttle.rb index 672140a..071646b 100644 --- a/lib/rack/attack/throttle.rb +++ b/lib/rack/attack/throttle.rb @@ -7,7 +7,8 @@ module Rack attr_reader :name, :limit, :period, :block, :type def initialize(name, options, &block) - @name, @block = name, block + @name = name + @block = block MANDATORY_OPTIONS.each do |opt| raise ArgumentError, "Must pass #{opt.inspect} option" unless options[opt] end