Commit 3577cab

mo khan <mo@mokhan.ca>
2024-12-06 00:41:15
chore: upgrade to minimum Ruby 3.1
1 parent f11258f
.github/workflows/ci.yml
@@ -9,7 +9,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4']
+        ruby-version: ['3.1', '3.2', '3.3', '3.4']
     steps:
       - uses: actions/checkout@v2
       - name: Set up Ruby
@@ -25,7 +25,7 @@ jobs:
       - uses: actions/checkout@v2
       - uses: ruby/setup-ruby@v1
         with:
-          ruby-version: '3.0'
+          ruby-version: '3.1'
           bundler-cache: true
       - name: Running style checks…
         run: sh bin/style
@@ -35,7 +35,7 @@ jobs:
       - uses: actions/checkout@v2
       - uses: ruby/setup-ruby@v1
         with:
-          ruby-version: '3.0'
+          ruby-version: '3.1'
           bundler-cache: true
       - name: Running audit…
         run: sh bin/audit
lib/scim/kit/v2/attributable.rb
@@ -66,10 +66,8 @@ module Scim
 
         # yields each attribute to the provided block
         # @param [Block] the block to yield each attribute to.
-        def each
-          dynamic_attributes.each do |_name, attribute|
-            yield attribute
-          end
+        def each(&block)
+          dynamic_attributes.each_value(&block)
         end
 
         private
lib/scim/kit/v2/messages.rb
@@ -5,12 +5,12 @@ module Scim
     module V2
       module Messages
         CORE = 'urn:ietf:params:scim:api:messages:2.0'
-        BULK_REQUEST = "#{CORE}:BulkRequest"
-        BULK_RESPONSE = "#{CORE}:BulkResponse"
-        ERROR = "#{CORE}:Error"
-        LIST_RESPONSE = "#{CORE}:ListResponse"
-        PATCH_OP = "#{CORE}:PatchOp"
-        SEARCH_REQUEST = "#{CORE}:SearchRequest"
+        BULK_REQUEST = "#{CORE}:BulkRequest".freeze
+        BULK_RESPONSE = "#{CORE}:BulkResponse".freeze
+        ERROR = "#{CORE}:Error".freeze
+        LIST_RESPONSE = "#{CORE}:ListResponse".freeze
+        PATCH_OP = "#{CORE}:PatchOp".freeze
+        SEARCH_REQUEST = "#{CORE}:SearchRequest".freeze
       end
     end
   end
lib/scim/kit/v2/schemas.rb
@@ -6,14 +6,14 @@ module Scim
       module Schemas
         ROOT = 'urn:ietf:params:scim:schemas'
 
-        CORE = "#{ROOT}:core:2.0"
-        EXTENSION = "#{ROOT}:extension"
-        ENTERPRISE_USER = "#{EXTENSION}:enterprise:2.0:User"
-        GROUP = "#{CORE}:Group"
-        RESOURCE_TYPE = "#{CORE}:ResourceType"
-        SCHEMA = "#{CORE}:Schema"
-        SERVICE_PROVIDER_CONFIGURATION = "#{CORE}:ServiceProviderConfig"
-        USER = "#{CORE}:User"
+        CORE = "#{ROOT}:core:2.0".freeze
+        EXTENSION = "#{ROOT}:extension".freeze
+        ENTERPRISE_USER = "#{EXTENSION}:enterprise:2.0:User".freeze
+        GROUP = "#{CORE}:Group".freeze
+        RESOURCE_TYPE = "#{CORE}:ResourceType".freeze
+        SCHEMA = "#{CORE}:Schema".freeze
+        SERVICE_PROVIDER_CONFIGURATION = "#{CORE}:ServiceProviderConfig".freeze
+        USER = "#{CORE}:User".freeze
       end
     end
   end
lib/scim/kit/v2.rb
@@ -29,7 +29,7 @@ module Scim
     module V2
       BASE64 = %r(
         \A([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?\Z
-      )x.freeze
+      )x
       BOOLEAN_VALUES = [true, false].freeze
       DATATYPES = {
         string: 'string',
lib/scim/kit.rb
@@ -25,7 +25,7 @@ module Scim
     TYPE_ERROR = ArgumentError.new(:type)
 
     def self.logger
-      @logger ||= Logger.new(STDOUT)
+      @logger ||= Logger.new($stdout)
     end
 
     def self.logger=(logger)
.rubocop.yml
@@ -7,7 +7,7 @@ AllCops:
     - 'pkg/**/*'
     - 'tmp/**/*'
     - 'vendor/**/*'
-  TargetRubyVersion: 2.7
+  TargetRubyVersion: 3.1
 
 Layout/ArgumentAlignment:
   EnforcedStyle: with_fixed_indentation
@@ -23,6 +23,7 @@ Layout/LineLength:
     - 'spec/**/*.rb'
   IgnoredPatterns:
     - '^#*'
+  Max: 80
 
 Layout/MultilineMethodCallIndentation:
   Enabled: true
@@ -37,6 +38,10 @@ Lint/AmbiguousBlockAssociation:
   Exclude:
     - 'spec/**/*.rb'
 
+Lint/EmptyFile:
+  Exclude:
+    - 'lib/scim/kit/v2/templates/nil_class.json.jbuilder'
+
 Lint/RaiseException:
   Enabled: true
 
@@ -64,6 +69,9 @@ Naming/FileName:
 Naming/RescuedExceptionsVariableName:
   PreferredName: error
 
+Style/AccessorGrouping:
+  Enabled: false
+
 Style/Documentation:
   Enabled: false
 
@@ -83,6 +91,9 @@ Style/IfUnlessModifier:
 Style/StringLiterals:
   EnforcedStyle: 'single_quotes'
 
+Style/SymbolProc:
+  Enabled: false
+
 Style/TrailingCommaInArrayLiteral:
   Enabled: false
 
Gemfile.lock
@@ -57,6 +57,8 @@ GEM
     jbuilder (2.13.0)
       actionview (>= 5.0.0)
       activesupport (>= 5.0.0)
+    json (2.9.0)
+    language_server-protocol (3.17.0.3)
     logger (1.6.2)
     loofah (2.23.1)
       crass (~> 1.0.2)
@@ -101,20 +103,29 @@ GEM
       diff-lcs (>= 1.2.0, < 2.0)
       rspec-support (~> 3.13.0)
     rspec-support (3.13.2)
-    rubocop (0.93.1)
+    rubocop (1.69.1)
+      json (~> 2.3)
+      language_server-protocol (>= 3.17.0)
       parallel (~> 1.10)
-      parser (>= 2.7.1.5)
+      parser (>= 3.3.0.2)
       rainbow (>= 2.2.2, < 4.0)
-      regexp_parser (>= 1.8)
-      rexml
-      rubocop-ast (>= 0.6.0)
+      regexp_parser (>= 2.9.3, < 3.0)
+      rubocop-ast (>= 1.36.2, < 2.0)
       ruby-progressbar (~> 1.7)
-      unicode-display_width (>= 1.4.0, < 2.0)
+      unicode-display_width (>= 2.4.0, < 4.0)
     rubocop-ast (1.36.2)
       parser (>= 3.3.1.0)
-    rubocop-rspec (1.44.1)
-      rubocop (~> 0.87)
-      rubocop-ast (>= 0.7.1)
+    rubocop-capybara (2.21.0)
+      rubocop (~> 1.41)
+    rubocop-factory_bot (2.26.1)
+      rubocop (~> 1.61)
+    rubocop-rspec (2.31.0)
+      rubocop (~> 1.40)
+      rubocop-capybara (~> 2.17)
+      rubocop-factory_bot (~> 2.22)
+      rubocop-rspec_rails (~> 2.28)
+    rubocop-rspec_rails (2.29.1)
+      rubocop (~> 1.61)
     ruby-progressbar (1.13.0)
     securerandom (0.4.0)
     thor (1.3.2)
@@ -124,7 +135,9 @@ GEM
       tilt (>= 1.3.0, < 3)
     tzinfo (2.0.6)
       concurrent-ruby (~> 1.0)
-    unicode-display_width (1.8.0)
+    unicode-display_width (3.1.2)
+      unicode-emoji (~> 4.0, >= 4.0.4)
+    unicode-emoji (4.0.4)
     webmock (3.24.0)
       addressable (>= 2.8.0)
       crack (>= 0.3.2)
@@ -139,8 +152,8 @@ DEPENDENCIES
   ffaker (~> 2.7)
   rake (~> 13.0)
   rspec (~> 3.0)
-  rubocop (~> 0.52)
-  rubocop-rspec (~> 1.22)
+  rubocop (~> 1.0)
+  rubocop-rspec (~> 2.0)
   scim-kit!
   webmock (~> 3.5)
 
scim-kit.gemspec
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
     File.basename(file)
   end
   spec.require_paths = ['lib']
-  spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
+  spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0')
   spec.metadata['yard.run'] = 'yri'
 
   spec.add_dependency 'activemodel', '>= 6.1', '< 8.0'
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
   spec.add_development_dependency 'ffaker', '~> 2.7'
   spec.add_development_dependency 'rake', '~> 13.0'
   spec.add_development_dependency 'rspec', '~> 3.0'
-  spec.add_development_dependency 'rubocop', '~> 0.52'
-  spec.add_development_dependency 'rubocop-rspec', '~> 1.22'
+  spec.add_development_dependency 'rubocop', '~> 1.0'
+  spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
   spec.add_development_dependency 'webmock', '~> 3.5'
 end