diff --git a/.rubocop.yml b/.rubocop.yml index b12c0b4..2aebea2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -68,6 +68,12 @@ Style/FrozenStringLiteralComment: Style/HashSyntax: Enabled: true +Style/MultilineTernaryOperator: + Enabled: true + +Style/NestedTernaryOperator: + Enabled: true + Style/OptionalArguments: Enabled: true diff --git a/lib/rack/attack.rb b/lib/rack/attack.rb index d29bf68..47ba82f 100644 --- a/lib/rack/attack.rb +++ b/lib/rack/attack.rb @@ -110,12 +110,18 @@ module Rack @app.call(env) elsif configuration.blocklisted?(request) # Deprecated: Keeping blocklisted_response for backwards compatibility - configuration.blocklisted_response ? configuration.blocklisted_response.call(env) : - configuration.blocklisted_callback.call(request) + if configuration.blocklisted_response + configuration.blocklisted_response.call(env) + else + configuration.blocklisted_callback.call(request) + end elsif configuration.throttled?(request) # Deprecated: Keeping throttled_response for backwards compatibility - configuration.throttled_response ? configuration.throttled_response.call(env) : - configuration.throttled_callback.call(request) + if configuration.throttled_response + configuration.throttled_response.call(env) + else + configuration.throttled_callback.call(request) + end else configuration.tracked?(request) @app.call(env)