mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
style: update to latest rubocop
This commit is contained in:
parent
8fafa7602b
commit
0ce6befd68
4 changed files with 10 additions and 6 deletions
|
|
@ -1,3 +1,6 @@
|
|||
require:
|
||||
- rubocop-performance
|
||||
|
||||
inherit_mode:
|
||||
merge:
|
||||
- Exclude
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ module Rack
|
|||
end
|
||||
|
||||
def safelists
|
||||
@safelists ||= {}
|
||||
@safelists ||= {}
|
||||
end
|
||||
|
||||
def blocklists
|
||||
|
|
@ -75,11 +75,11 @@ module Rack
|
|||
end
|
||||
|
||||
def throttles
|
||||
@throttles ||= {}
|
||||
@throttles ||= {}
|
||||
end
|
||||
|
||||
def tracks
|
||||
@tracks ||= {}
|
||||
@tracks ||= {}
|
||||
end
|
||||
|
||||
def safelisted?(request)
|
||||
|
|
@ -136,7 +136,7 @@ module Rack
|
|||
# Set defaults
|
||||
@anonymous_blocklists = []
|
||||
@anonymous_safelists = []
|
||||
@notifier = ActiveSupport::Notifications if defined?(ActiveSupport::Notifications)
|
||||
@notifier = ActiveSupport::Notifications if defined?(ActiveSupport::Notifications)
|
||||
@blocklisted_response = lambda { |_env| [403, { 'Content-Type' => 'text/plain' }, ["Forbidden\n"]] }
|
||||
@throttled_response = lambda do |env|
|
||||
retry_after = (env['rack.attack.match_data'] || {})[:period]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module Rack
|
|||
MANDATORY_OPTIONS.each do |opt|
|
||||
raise ArgumentError, "Must pass #{opt.inspect} option" unless options[opt]
|
||||
end
|
||||
@limit = options[:limit]
|
||||
@limit = options[:limit]
|
||||
@period = options[:period].respond_to?(:call) ? options[:period] : options[:period].to_i
|
||||
@type = options.fetch(:type, :throttle)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ Gem::Specification.new do |s|
|
|||
s.add_development_dependency "minitest-stub-const", "~> 0.6"
|
||||
s.add_development_dependency 'rack-test', "~> 1.0"
|
||||
s.add_development_dependency 'rake', "~> 12.3"
|
||||
s.add_development_dependency "rubocop", "0.67.2"
|
||||
s.add_development_dependency "rubocop", "0.74.0"
|
||||
s.add_development_dependency "rubocop-performance", "~> 1.4.1"
|
||||
s.add_development_dependency "timecop", "~> 0.9.1"
|
||||
|
||||
# byebug only works with MRI
|
||||
|
|
|
|||
Loading…
Reference in a new issue