From 55a2ece27b3298a5495da0c198777749176542ce Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Thu, 3 Mar 2022 13:21:03 +0300 Subject: [PATCH 01/13] Add support for rails 6.1 & 7.0 --- .travis.yml | 10 ++++++++++ acts_as_hashids.gemspec | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0a55624..179808c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,8 @@ env: - ACTIVE_RECORD_VERSION=4.2.0 SQLITE3_VERSION=1.3.13 - ACTIVE_RECORD_VERSION=5.0.0 SQLITE3_VERSION=1.3.13 - ACTIVE_RECORD_VERSION=6.0.0 + - ACTIVE_RECORD_VERSION=6.1.0 + - ACTIVE_RECORD_VERSION=7.0.0 matrix: allow_failures: - rvm: 2.4 @@ -35,6 +37,14 @@ matrix: env: ACTIVE_RECORD_VERSION=4.2.0 SQLITE3_VERSION=1.3.13 - rvm: 2.4 env: ACTIVE_RECORD_VERSION=6.0.0 + - rvm: 2.4 + env: ACTIVE_RECORD_VERSION=6.1.0 + - rvm: 2.4 + env: ACTIVE_RECORD_VERSION=7.0.0 + - rvm: 2.5 + env: ACTIVE_RECORD_VERSION=7.0.0 + - rvm: 2.6 + env: ACTIVE_RECORD_VERSION=7.0.0 before_install: - gem update --system - gem --version diff --git a/acts_as_hashids.gemspec b/acts_as_hashids.gemspec index f6134f3..27692fb 100644 --- a/acts_as_hashids.gemspec +++ b/acts_as_hashids.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ['>= 2.2.2', '< 3.0'] - spec.add_runtime_dependency 'activerecord', '>= 4.0', '< 6.1' + spec.add_runtime_dependency 'activerecord', '>= 4.0', '< 7.1' spec.add_runtime_dependency 'hashids', '~> 1.0' spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.5' From 2ff6cdc4cba1e5bf757e3450e0d821bcc89f7e5c Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Wed, 9 Mar 2022 15:10:27 +0300 Subject: [PATCH 02/13] Added support for ruby version 3.0 --- .travis.yml | 9 +++++++++ acts_as_hashids.gemspec | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 179808c..3cf191a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ rvm: - 2.5 - 2.6 - 2.7 + - 3.0 env: jobs: - @@ -35,8 +36,16 @@ matrix: env: ACTIVE_RECORD_VERSION=4.1.0 SQLITE3_VERSION=1.3.13 - rvm: 2.7 env: ACTIVE_RECORD_VERSION=4.2.0 SQLITE3_VERSION=1.3.13 + - rvm: 3.0 + env: ACTIVE_RECORD_VERSION=4.0.0 SQLITE3_VERSION=1.3.13 + - rvm: 3.0 + env: ACTIVE_RECORD_VERSION=4.1.0 SQLITE3_VERSION=1.3.13 + - rvm: 3.0 + env: ACTIVE_RECORD_VERSION=4.2.0 SQLITE3_VERSION=1.3.13 - rvm: 2.4 env: ACTIVE_RECORD_VERSION=6.0.0 + - rvm: 3.0 + env: ACTIVE_RECORD_VERSION=6.0.0 - rvm: 2.4 env: ACTIVE_RECORD_VERSION=6.1.0 - rvm: 2.4 diff --git a/acts_as_hashids.gemspec b/acts_as_hashids.gemspec index 27692fb..607767b 100644 --- a/acts_as_hashids.gemspec +++ b/acts_as_hashids.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.required_ruby_version = ['>= 2.2.2', '< 3.0'] + spec.required_ruby_version = ['>= 2.2.2', '< 3.1'] spec.add_runtime_dependency 'activerecord', '>= 4.0', '< 7.1' spec.add_runtime_dependency 'hashids', '~> 1.0' From 07e52fb3a093a592994f3b1a6d3180a0d41e6a01 Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Wed, 9 Mar 2022 16:33:16 +0300 Subject: [PATCH 03/13] Fixed separation of positional arguments from keyword arguments in ActAsHashids::Core::ClassMethods#has_many. --- lib/acts_as_hashids/core.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/acts_as_hashids/core.rb b/lib/acts_as_hashids/core.rb index 6048a4b..7ddf508 100644 --- a/lib/acts_as_hashids/core.rb +++ b/lib/acts_as_hashids/core.rb @@ -62,7 +62,7 @@ def with_hashids(*ids) def has_many(*args, &block) # rubocop:disable Style/PredicateName options = args.extract_options! options[:extend] = (options[:extend] || []).concat([FinderMethods]) - super(*args, options, &block) + super(*args, **options, &block) end def relation From e288dc1720d90987109c9498b96eca906a4637f0 Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Wed, 9 Mar 2022 17:09:46 +0300 Subject: [PATCH 04/13] Added Rails 5(ACTIVE_RECORD_VERSION=5.0.0) as an allowable failure on Ruby 3.0 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 3cf191a..df98959 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,6 +42,8 @@ matrix: env: ACTIVE_RECORD_VERSION=4.1.0 SQLITE3_VERSION=1.3.13 - rvm: 3.0 env: ACTIVE_RECORD_VERSION=4.2.0 SQLITE3_VERSION=1.3.13 + - rvm: 3.0 + env: ACTIVE_RECORD_VERSION=5.0.0 SQLITE3_VERSION=1.3.13 - rvm: 2.4 env: ACTIVE_RECORD_VERSION=6.0.0 - rvm: 3.0 From e2c3dbfe2a102c7c129e80400f2324c66704973b Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Wed, 9 Mar 2022 20:31:03 +0300 Subject: [PATCH 05/13] Added support for Ruby 3.1 . --- .travis.yml | 11 +++++++++++ acts_as_hashids.gemspec | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index df98959..fd666b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ rvm: - 2.6 - 2.7 - 3.0 + - 3.1 env: jobs: - @@ -44,10 +45,20 @@ matrix: env: ACTIVE_RECORD_VERSION=4.2.0 SQLITE3_VERSION=1.3.13 - rvm: 3.0 env: ACTIVE_RECORD_VERSION=5.0.0 SQLITE3_VERSION=1.3.13 + - rvm: 3.1 + env: ACTIVE_RECORD_VERSION=4.0.0 SQLITE3_VERSION=1.3.13 + - rvm: 3.1 + env: ACTIVE_RECORD_VERSION=4.1.0 SQLITE3_VERSION=1.3.13 + - rvm: 3.1 + env: ACTIVE_RECORD_VERSION=4.2.0 SQLITE3_VERSION=1.3.13 + - rvm: 3.1 + env: ACTIVE_RECORD_VERSION=5.0.0 SQLITE3_VERSION=1.3.13 - rvm: 2.4 env: ACTIVE_RECORD_VERSION=6.0.0 - rvm: 3.0 env: ACTIVE_RECORD_VERSION=6.0.0 + - rvm: 3.1 + env: ACTIVE_RECORD_VERSION=6.0.0 - rvm: 2.4 env: ACTIVE_RECORD_VERSION=6.1.0 - rvm: 2.4 diff --git a/acts_as_hashids.gemspec b/acts_as_hashids.gemspec index 607767b..6741e68 100644 --- a/acts_as_hashids.gemspec +++ b/acts_as_hashids.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.required_ruby_version = ['>= 2.2.2', '< 3.1'] + spec.required_ruby_version = ['>= 2.2.2', '<= 3.1.1'] spec.add_runtime_dependency 'activerecord', '>= 4.0', '< 7.1' spec.add_runtime_dependency 'hashids', '~> 1.0' From eea874f76e7a51afa1b1a1c5e241eae57592a400 Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Wed, 9 Mar 2022 22:51:26 +0300 Subject: [PATCH 06/13] Updated rubocop development dependency version to the latest version that supports >= Ruby 2.2.2 . --- acts_as_hashids.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acts_as_hashids.gemspec b/acts_as_hashids.gemspec index 6741e68..8890b5a 100644 --- a/acts_as_hashids.gemspec +++ b/acts_as_hashids.gemspec @@ -28,7 +28,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'coveralls', '~> 0.8' spec.add_development_dependency 'rake', '~> 10.0' spec.add_development_dependency 'rspec', '~> 3.0' - spec.add_development_dependency 'rubocop', '~> 0.54.0' + spec.add_development_dependency 'rubocop', '~> 0.68.0' spec.add_development_dependency 'rubocop-rspec', '~> 1.24.0' spec.add_development_dependency 'simplecov', '~> 0.11' spec.add_development_dependency 'sqlite3', '~> 1.3' From f990c065c92382e63e0ac14aeb4b2163b08d0070 Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Wed, 9 Mar 2022 23:07:00 +0300 Subject: [PATCH 07/13] Renamed cop to . --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3ee5cbe..ea3c3c1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -27,7 +27,7 @@ Style/SignalException: EnforcedStyle: only_raise Layout/IndentHash: EnforcedStyle: consistent -Layout/IndentArray: +Layout/IndentFirstArrayElement: EnforcedStyle: consistent Layout/EndAlignment: EnforcedStyleAlignWith: variable From 6dbcececc0be750e091c689660ba08cb9846e607 Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Wed, 9 Mar 2022 23:23:33 +0300 Subject: [PATCH 08/13] Renamed cop Layout/IndentHash to Layout/IndentFirstHashElement. --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index ea3c3c1..1632793 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -25,7 +25,7 @@ Documentation: Enabled: false Style/SignalException: EnforcedStyle: only_raise -Layout/IndentHash: +Layout/IndentFirstHashElement: EnforcedStyle: consistent Layout/IndentFirstArrayElement: EnforcedStyle: consistent From 5508310bb3cd4c51c42829730e0b4320c42ecf56 Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Thu, 10 Mar 2022 18:03:10 +0300 Subject: [PATCH 09/13] Updated rubocop development dependency to 0.81.0. and least required_ruby_version to 2.3.0 --- acts_as_hashids.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/acts_as_hashids.gemspec b/acts_as_hashids.gemspec index 8890b5a..ee3e713 100644 --- a/acts_as_hashids.gemspec +++ b/acts_as_hashids.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.required_ruby_version = ['>= 2.2.2', '<= 3.1.1'] + spec.required_ruby_version = ['>= 2.3.0', '<= 3.1.1'] spec.add_runtime_dependency 'activerecord', '>= 4.0', '< 7.1' spec.add_runtime_dependency 'hashids', '~> 1.0' @@ -28,7 +28,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'coveralls', '~> 0.8' spec.add_development_dependency 'rake', '~> 10.0' spec.add_development_dependency 'rspec', '~> 3.0' - spec.add_development_dependency 'rubocop', '~> 0.68.0' + spec.add_development_dependency 'rubocop', '~> 0.81.0' spec.add_development_dependency 'rubocop-rspec', '~> 1.24.0' spec.add_development_dependency 'simplecov', '~> 0.11' spec.add_development_dependency 'sqlite3', '~> 1.3' From a68b877d1aa6abcccdf118433377981d7e1cbb4a Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Thu, 10 Mar 2022 18:13:32 +0300 Subject: [PATCH 10/13] Renamed cops Layout/IndentFirstHashElement and Layout/IndentFirstArrayElement. --- .rubocop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 1632793..7bc989b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -25,9 +25,9 @@ Documentation: Enabled: false Style/SignalException: EnforcedStyle: only_raise -Layout/IndentFirstHashElement: +Layout/FirstHashElementIndentation: EnforcedStyle: consistent -Layout/IndentFirstArrayElement: +Layout/FirstArrayElementIndentation: EnforcedStyle: consistent Layout/EndAlignment: EnforcedStyleAlignWith: variable From 19bfac11042f1e0202dc60619250d465458803f9 Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Thu, 10 Mar 2022 18:32:54 +0300 Subject: [PATCH 11/13] Added new default configurations to Rubocop with Enabled set to false. --- .rubocop.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 7bc989b..83f8590 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -7,12 +7,6 @@ AllCops: - "vendor/**/*" Metrics/AbcSize: Max: 40 -Metrics/LineLength: - Max: 125 - AllowURI: true - URISchemes: - - http - - https Metrics/MethodLength: Max: 20 Metrics/CyclomaticComplexity: @@ -25,6 +19,12 @@ Documentation: Enabled: false Style/SignalException: EnforcedStyle: only_raise +Layout/LineLength: + Max: 125 + AllowURI: true + URISchemes: + - http + - https Layout/FirstHashElementIndentation: EnforcedStyle: consistent Layout/FirstArrayElementIndentation: @@ -33,6 +33,18 @@ Layout/EndAlignment: EnforcedStyleAlignWith: variable Lint/InheritException: Enabled: false +Lint/SendWithMixinArgument: + Enabled: false +Lint/RaiseException: + Enabled: false +Lint/StructNewOverride: + Enabled: false +Style/HashEachMethods: + Enabled: false +Style/HashTransformKeys: + Enabled: false +Style/HashTransformValues: + Enabled: false Style/FrozenStringLiteralComment: Enabled: false RSpec/AnyInstance: From 39d140fd19f17052b6bb06c5958ac0fe6bd7f651 Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Thu, 10 Mar 2022 23:49:04 +0300 Subject: [PATCH 12/13] Added Style namespace to Documentation cop. Changed Style/PredicateName namespace to Naming. --- .rubocop.yml | 2 +- lib/acts_as_hashids/core.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 83f8590..568b758 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -15,7 +15,7 @@ Metrics/PerceivedComplexity: Max: 10 Metrics/BlockLength: Enabled: false -Documentation: +Style/Documentation: Enabled: false Style/SignalException: EnforcedStyle: only_raise diff --git a/lib/acts_as_hashids/core.rb b/lib/acts_as_hashids/core.rb index 7ddf508..19c3aae 100644 --- a/lib/acts_as_hashids/core.rb +++ b/lib/acts_as_hashids/core.rb @@ -59,7 +59,7 @@ def with_hashids(*ids) where(primary_key => decoded_ids) end - def has_many(*args, &block) # rubocop:disable Style/PredicateName + def has_many(*args, &block) # rubocop:disable Naming/PredicateName options = args.extract_options! options[:extend] = (options[:extend] || []).concat([FinderMethods]) super(*args, **options, &block) From 354ff67c7a7e094ca19e1c3ccfc5851c30c9f314 Mon Sep 17 00:00:00 2001 From: Philip Maina Date: Wed, 16 Mar 2022 19:44:13 +0300 Subject: [PATCH 13/13] Fixed latest required ruby version to '< 3.2' . --- acts_as_hashids.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acts_as_hashids.gemspec b/acts_as_hashids.gemspec index ee3e713..ecee755 100644 --- a/acts_as_hashids.gemspec +++ b/acts_as_hashids.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.required_ruby_version = ['>= 2.3.0', '<= 3.1.1'] + spec.required_ruby_version = ['>= 2.3.0', '< 3.2'] spec.add_runtime_dependency 'activerecord', '>= 4.0', '< 7.1' spec.add_runtime_dependency 'hashids', '~> 1.0'