diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bae7d85a..badfcc4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,8 +17,6 @@ jobs: strategy: matrix: ruby: - - '2.7' - - '3.0' - '3.1' - '3.2' steps: diff --git a/.rubocop.yml b/.rubocop.yml index 950d663f..a32030b0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,5 @@ -# Disabling due to conflict with Ruby 2.7/3.1 -Layout/BlockAlignment: - Enabled: false +inherit_from: .rubocop_todo.yml + Layout/DotPosition: EnforcedStyle: trailing Layout/EmptyLineAfterMagicComment: @@ -8,11 +7,11 @@ Layout/EmptyLineAfterMagicComment: Layout/EmptyLines: Enabled: false Layout/LineLength: - IgnoredPatterns: + AllowedPatterns: - 'VCR\.use_cassette' - '(\A|\s)/.*?/' Metrics/BlockLength: - ExcludedMethods: ['describe', 'context', 'before', 'it'] + AllowedMethods: ['describe', 'context', 'before', 'it'] Metrics/MethodLength: Max: 30 Metrics/ModuleLength: @@ -28,4 +27,4 @@ Style/TrailingCommaInArguments: Style/TrailingCommaInHashLiteral: EnforcedStyleForMultiline: 'consistent_comma' AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.1 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 00000000..54f5f130 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,94 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2025-01-22 21:38:20 UTC using RuboCop version 1.71.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleAlignWith. +# SupportedStylesAlignWith: either, start_of_block, start_of_line +Layout/BlockAlignment: + Exclude: + - 'spec/lib/workos/session_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLinesAroundMethodBody: + Exclude: + - 'lib/workos/mfa.rb' + - 'lib/workos/user_management.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceAroundMethodCallOperator: + Exclude: + - 'spec/lib/workos/directory_sync_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/DuplicateRequire: + Exclude: + - 'lib/workos/session.rb' + +# Offense count: 3 +# Configuration parameters: AllowedParentClasses. +Lint/MissingSuper: + Exclude: + - 'lib/workos/directory_group.rb' + - 'lib/workos/directory_user.rb' + - 'lib/workos/errors.rb' + +# Offense count: 5 +# Configuration parameters: CountComments, CountAsOne. +Metrics/ClassLength: + Max: 624 + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: separated, grouped +Style/AccessorGrouping: + Exclude: + - 'lib/workos/errors.rb' + +# Offense count: 34 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: braces, no_braces +Style/HashAsLastArrayItem: + Exclude: + - 'spec/lib/workos/directory_sync_spec.rb' + - 'spec/lib/workos/event_spec.rb' + - 'spec/lib/workos/organizations_spec.rb' + - 'spec/lib/workos/sso_spec.rb' + - 'spec/lib/workos/user_management_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/KeywordParametersOrder: + Exclude: + - 'lib/workos/organizations.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: SafeForConstants. +Style/RedundantFetchBlock: + Exclude: + - 'spec/lib/workos/cache_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowMultipleReturnValues. +Style/RedundantReturn: + Exclude: + - 'lib/workos/directory_user.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SlicingWithRange: + Exclude: + - 'lib/workos/deprecated_hash_wrapper.rb' + - 'lib/workos/session.rb' diff --git a/Gemfile.lock b/Gemfile.lock index 125ad336..ad714ef5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,16 +19,18 @@ GEM diff-lcs (1.5.1) encryptor (3.0.0) hashdiff (1.1.0) + json (2.9.1) jwt (2.10.1) base64 - parallel (1.24.0) - parser (3.3.0.5) + language_server-protocol (3.17.0.3) + parallel (1.26.3) + parser (3.3.7.0) ast (~> 2.4.1) racc public_suffix (5.0.4) - racc (1.7.3) + racc (1.8.1) rainbow (3.1.1) - regexp_parser (2.9.0) + regexp_parser (2.10.0) rexml (3.2.6) rspec (3.9.0) rspec-core (~> 3.9.0) @@ -43,19 +45,22 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-support (3.9.4) - rubocop (0.93.1) + rubocop (1.71.0) + 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) - rubocop-ast (1.31.2) - parser (>= 3.3.0.4) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.37.0) + parser (>= 3.3.1.0) ruby-progressbar (1.13.0) - unicode-display_width (1.8.0) + unicode-display_width (3.1.4) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) vcr (5.0.0) webmock (3.23.0) addressable (>= 2.8.0) @@ -68,7 +73,7 @@ PLATFORMS DEPENDENCIES bundler (>= 2.0.1) rspec (~> 3.9.0) - rubocop (~> 0.77) + rubocop (~> 1.71) vcr (~> 5.0.0) webmock workos! diff --git a/lib/workos/session.rb b/lib/workos/session.rb index 348b09fa..9ce6f14f 100644 --- a/lib/workos/session.rb +++ b/lib/workos/session.rb @@ -11,7 +11,6 @@ module WorkOS # The Session class provides helper methods for working with WorkOS sessions # This class is not meant to be instantiated in a user space, and is instantiated internally but exposed. - # rubocop:disable Metrics/ClassLength class Session attr_accessor :jwks, :jwks_algorithms, :user_management, :cookie_password, :session_data, :client_id @@ -180,5 +179,4 @@ def is_valid_jwt(token) end # rubocop:enable Naming/PredicateName end - # rubocop:enable Metrics/ClassLength end diff --git a/workos.gemspec b/workos.gemspec index 98d092b9..20b5f427 100644 --- a/workos.gemspec +++ b/workos.gemspec @@ -26,9 +26,9 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler', '>= 2.0.1' spec.add_development_dependency 'rspec', '~> 3.9.0' - spec.add_development_dependency 'rubocop', '~> 0.77' + spec.add_development_dependency 'rubocop', '~> 1.71' spec.add_development_dependency 'vcr', '~> 5.0.0' spec.add_development_dependency 'webmock' - spec.required_ruby_version = '>= 2.7' + spec.required_ruby_version = '>= 3.1' end