From f5a352b8f96a26648ae9300d369c056c4766bc00 Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Fri, 2 Aug 2019 10:51:53 -0300 Subject: [PATCH] style: limit line length to 120 columns --- .rubocop.yml | 3 +++ lib/rack/attack/cache.rb | 5 ++++- .../store_proxy/active_support_redis_store_proxy.rb | 4 +++- lib/rack/attack/store_proxy/mem_cache_store_proxy.rb | 4 +++- .../active_support_redis_cache_store_pooled_spec.rb | 8 +++++++- .../stores/active_support_redis_cache_store_spec.rb | 7 ++++++- 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b96f7f3..f83a594 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -26,6 +26,9 @@ Naming: Exclude: - "lib/rack/attack/path_normalizer.rb" +Metrics/LineLength: + Max: 120 + Performance: Enabled: true diff --git a/lib/rack/attack/cache.rb b/lib/rack/attack/cache.rb index 53f09f1..cfa2efa 100644 --- a/lib/rack/attack/cache.rb +++ b/lib/rack/attack/cache.rb @@ -73,7 +73,10 @@ module Rack def enforce_store_method_presence!(method_name) if !store.respond_to?(method_name) - raise Rack::Attack::MisconfiguredStoreError, "Configured store #{store.class.name} doesn't respond to ##{method_name} method" + raise( + Rack::Attack::MisconfiguredStoreError, + "Configured store #{store.class.name} doesn't respond to ##{method_name} method" + ) end end end diff --git a/lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb b/lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb index a18d081..68f0326 100644 --- a/lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb +++ b/lib/rack/attack/store_proxy/active_support_redis_store_proxy.rb @@ -7,7 +7,9 @@ module Rack module StoreProxy class ActiveSupportRedisStoreProxy < SimpleDelegator def self.handle?(store) - defined?(::Redis) && defined?(::ActiveSupport::Cache::RedisStore) && store.is_a?(::ActiveSupport::Cache::RedisStore) + defined?(::Redis) && + defined?(::ActiveSupport::Cache::RedisStore) && + store.is_a?(::ActiveSupport::Cache::RedisStore) end def increment(name, amount = 1, options = {}) diff --git a/lib/rack/attack/store_proxy/mem_cache_store_proxy.rb b/lib/rack/attack/store_proxy/mem_cache_store_proxy.rb index eebfed7..f8c036c 100644 --- a/lib/rack/attack/store_proxy/mem_cache_store_proxy.rb +++ b/lib/rack/attack/store_proxy/mem_cache_store_proxy.rb @@ -7,7 +7,9 @@ module Rack module StoreProxy class MemCacheStoreProxy < SimpleDelegator def self.handle?(store) - defined?(::Dalli) && defined?(::ActiveSupport::Cache::MemCacheStore) && store.is_a?(::ActiveSupport::Cache::MemCacheStore) + defined?(::Dalli) && + defined?(::ActiveSupport::Cache::MemCacheStore) && + store.is_a?(::ActiveSupport::Cache::MemCacheStore) end def write(name, value, options = {}) diff --git a/spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb b/spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb index 3bfc2cf..9c26e8d 100644 --- a/spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb +++ b/spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb @@ -2,7 +2,13 @@ require_relative "../../spec_helper" -if defined?(::ConnectionPool) && defined?(::Redis) && Gem::Version.new(::Redis::VERSION) >= Gem::Version.new("4") && defined?(::ActiveSupport::Cache::RedisCacheStore) +should_run = + defined?(::ConnectionPool) && + defined?(::Redis) && + Gem::Version.new(::Redis::VERSION) >= Gem::Version.new("4") && + defined?(::ActiveSupport::Cache::RedisCacheStore) + +if should_run require_relative "../../support/cache_store_helper" require "timecop" diff --git a/spec/acceptance/stores/active_support_redis_cache_store_spec.rb b/spec/acceptance/stores/active_support_redis_cache_store_spec.rb index 565ac29..f595ec2 100644 --- a/spec/acceptance/stores/active_support_redis_cache_store_spec.rb +++ b/spec/acceptance/stores/active_support_redis_cache_store_spec.rb @@ -2,7 +2,12 @@ require_relative "../../spec_helper" -if defined?(::Redis) && Gem::Version.new(::Redis::VERSION) >= Gem::Version.new("4") && defined?(::ActiveSupport::Cache::RedisCacheStore) +should_run = + defined?(::Redis) && + Gem::Version.new(::Redis::VERSION) >= Gem::Version.new("4") && + defined?(::ActiveSupport::Cache::RedisCacheStore) + +if should_run require_relative "../../support/cache_store_helper" require "timecop"