From c07fcdde434b6864c556baf0c5adf1e0edab854c Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Sun, 24 May 2020 17:50:56 +0200 Subject: [PATCH] Use RuboCop 0.84.0 - this enables each of the new Cops and marks each with the version they appeared in --- .rubocop.yml | 18 +++++++++++++++--- lib/rack/attack/cache.rb | 1 + lib/rack/attack/check.rb | 1 + lib/rack/attack/throttle.rb | 1 + rack-attack.gemspec | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 2aebea2..45bd079 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -21,12 +21,27 @@ Gemspec: Layout: Enabled: true +Layout/EmptyLinesAroundAttributeAccessor: # (0.83) + Enabled: true + +Layout/SpaceAroundMethodCallOperator: # (0.82) + Enabled: true + Layout/LineLength: Max: 120 Lint: Enabled: true +Lint/DeprecatedOpenSSLConstant: # (0.84) + Enabled: true + +Lint/RaiseException: # (0.81) + Enabled: true + +Lint/StructNewOverride: # (0.81) + Enabled: true + Naming: Enabled: true Exclude: @@ -42,9 +57,6 @@ Style/BlockDelimiters: Enabled: true IgnoredMethods: [] # Workaround rubocop bug: https://github.com/rubocop-hq/rubocop/issues/6179 -Style/BracesAroundHashParameters: - Enabled: true - Style/ClassAndModuleChildren: Enabled: true Exclude: diff --git a/lib/rack/attack/cache.rb b/lib/rack/attack/cache.rb index f27259e..0e1f606 100644 --- a/lib/rack/attack/cache.rb +++ b/lib/rack/attack/cache.rb @@ -12,6 +12,7 @@ module Rack end attr_reader :store + def store=(store) @store = if (proxy = BaseProxy.lookup(store)) diff --git a/lib/rack/attack/check.rb b/lib/rack/attack/check.rb index 4c985eb..c9f3ff7 100644 --- a/lib/rack/attack/check.rb +++ b/lib/rack/attack/check.rb @@ -4,6 +4,7 @@ module Rack class Attack class Check attr_reader :name, :block, :type + def initialize(name, options = {}, &block) @name = name @block = block diff --git a/lib/rack/attack/throttle.rb b/lib/rack/attack/throttle.rb index a1e21a7..1cc50f4 100644 --- a/lib/rack/attack/throttle.rb +++ b/lib/rack/attack/throttle.rb @@ -6,6 +6,7 @@ module Rack MANDATORY_OPTIONS = [:limit, :period].freeze attr_reader :name, :limit, :period, :block, :type + def initialize(name, options, &block) @name = name @block = block diff --git a/rack-attack.gemspec b/rack-attack.gemspec index 28dd3f8..69042f1 100644 --- a/rack-attack.gemspec +++ b/rack-attack.gemspec @@ -37,7 +37,7 @@ 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', "~> 13.0" - s.add_development_dependency "rubocop", "0.78.0" + s.add_development_dependency "rubocop", "0.84.0" s.add_development_dependency "rubocop-performance", "~> 1.5.0" s.add_development_dependency "timecop", "~> 0.9.1"