mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +00:00
style: enable Style/ParallelAssignment cop checks
This commit is contained in:
parent
9d2e66e4eb
commit
c0328707b1
4 changed files with 11 additions and 3 deletions
|
|
@ -67,6 +67,9 @@ Style/HashSyntax:
|
||||||
Style/OptionalArguments:
|
Style/OptionalArguments:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Style/ParallelAssignment:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Style/RaiseArgs:
|
Style/RaiseArgs:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,10 @@ module Rack
|
||||||
end
|
end
|
||||||
|
|
||||||
def clear_configuration
|
def clear_configuration
|
||||||
@safelists, @blocklists, @throttles, @tracks = {}, {}, {}, {}
|
@safelists = {}
|
||||||
|
@blocklists = {}
|
||||||
|
@throttles = {}
|
||||||
|
@tracks = {}
|
||||||
self.anonymous_blocklists = []
|
self.anonymous_blocklists = []
|
||||||
self.anonymous_safelists = []
|
self.anonymous_safelists = []
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ module Rack
|
||||||
class Check
|
class Check
|
||||||
attr_reader :name, :block, :type
|
attr_reader :name, :block, :type
|
||||||
def initialize(name, options = {}, &block)
|
def initialize(name, options = {}, &block)
|
||||||
@name, @block = name, block
|
@name = name
|
||||||
|
@block = block
|
||||||
@type = options.fetch(:type, nil)
|
@type = options.fetch(:type, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ module Rack
|
||||||
|
|
||||||
attr_reader :name, :limit, :period, :block, :type
|
attr_reader :name, :limit, :period, :block, :type
|
||||||
def initialize(name, options, &block)
|
def initialize(name, options, &block)
|
||||||
@name, @block = name, block
|
@name = name
|
||||||
|
@block = block
|
||||||
MANDATORY_OPTIONS.each do |opt|
|
MANDATORY_OPTIONS.each do |opt|
|
||||||
raise ArgumentError, "Must pass #{opt.inspect} option" unless options[opt]
|
raise ArgumentError, "Must pass #{opt.inspect} option" unless options[opt]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue