diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46e75337..56b8016f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,26 +8,11 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['2.6', '2.7', '3.0', '3.1', '3.2'] + ruby: ['3.0', '3.1', '3.2'] gemfile: - - gemfiles/rails_5_2.gemfile - - gemfiles/rails_6_0.gemfile - gemfiles/rails_6_1.gemfile - gemfiles/rails_7_0.gemfile - gemfiles/rails_7_1.gemfile - exclude: - - ruby: '3.2' - gemfile: gemfiles/rails_5_2.gemfile - - ruby: '3.1' - gemfile: gemfiles/rails_5_2.gemfile - - ruby: '3.0' - gemfile: gemfiles/rails_5_2.gemfile - - ruby: '2.7' - gemfile: gemfiles/rails_7_1.gemfile - - ruby: '2.6' - gemfile: gemfiles/rails_7_1.gemfile - - ruby: '2.6' - gemfile: gemfiles/rails_7_0.gemfile services: postgres: image: postgres diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 857bb4d4..70cd6c71 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -8,10 +8,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Ruby 2.7 + - name: Set up Ruby 3.0 uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.0 bundler-cache: true - name: Run Linter run: bundle exec rubocop --parallel diff --git a/.rubocop.yml b/.rubocop.yml index 637eed70..a98714a0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,10 +9,13 @@ inherit_mode: - Exclude AllCops: - TargetRubyVersion: 2.6 + TargetRubyVersion: 3.0 Exclude: - 'lib/generators/delayed/templates/*.rb' NewCops: enable Rails/EnvironmentVariableAccess: Enabled: false + +Style/FrozenStringLiteralComment: + Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 73641032..34acfc47 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 99999` -# on 2023-01-20 19:16:15 UTC using RuboCop version 1.43.0. +# on 2023-12-28 21:29:05 UTC using RuboCop version 1.59.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 @@ -33,6 +33,7 @@ Lint/ConstantDefinitionInBlock: - 'spec/message_sending_spec.rb' # Offense count: 2 +# Configuration parameters: AllowedParentClasses. Lint/MissingSuper: Exclude: - 'lib/delayed/message_sending.rb' @@ -50,7 +51,7 @@ Lint/SuppressedException: - 'lib/delayed/backend/base.rb' # Offense count: 4 -# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes, Max. +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max. Metrics/AbcSize: Exclude: - 'lib/delayed/message_sending.rb' @@ -62,14 +63,6 @@ RSpec/AnyInstance: Exclude: - 'spec/delayed/job_spec.rb' -# Offense count: 18 -# This cop supports unsafe autocorrection (--autocorrect-all). -RSpec/BeEq: - Exclude: - - 'spec/delayed/job_spec.rb' - - 'spec/delayed/priority_spec.rb' - - 'spec/message_sending_spec.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. @@ -165,11 +158,10 @@ Rake/DuplicateTask: Exclude: - 'Rakefile' -# Offense count: 4 +# Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). Security/YAMLLoad: Exclude: - - 'spec/delayed/serialization/active_record_spec.rb' - 'spec/helper.rb' - 'spec/yaml_ext_spec.rb' diff --git a/.ruby-version b/.ruby-version index a603bb50..be94e6f5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.5 +3.2.2 diff --git a/Appraisals b/Appraisals index 8e8f0c3a..8b212694 100644 --- a/Appraisals +++ b/Appraisals @@ -1,15 +1,3 @@ -appraise 'rails-5-2' do - gem 'actionmailer', '~> 5.2.0' - gem 'activejob', '~> 5.2.0' - gem 'activerecord', '~> 5.2.0' -end - -appraise 'rails-6-0' do - gem 'actionmailer', '~> 6.0.0' - gem 'activejob', '~> 6.0.0' - gem 'activerecord', '~> 6.0.0' -end - appraise 'rails-6-1' do gem 'actionmailer', '~> 6.1.0' gem 'activejob', '~> 6.1.0' diff --git a/delayed.gemspec b/delayed.gemspec index 0e4b0b9c..7412835c 100644 --- a/delayed.gemspec +++ b/delayed.gemspec @@ -18,15 +18,15 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.summary = 'a multi-threaded, SQL-driven ActiveJob backend used at Betterment to process millions of background jobs per day' - spec.version = '0.5.2' + spec.version = '0.6.0' spec.metadata = { 'changelog_uri' => 'https://github.com/betterment/delayed/blob/main/CHANGELOG.md', 'bug_tracker_uri' => 'https://github.com/betterment/delayed/issues', 'source_code_uri' => 'https://github.com/betterment/delayed', 'rubygems_mfa_required' => 'true', } - spec.required_ruby_version = '>= 2.6' + spec.required_ruby_version = '>= 3.0' - spec.add_dependency 'activerecord', '>= 5.2' + spec.add_dependency 'activerecord', '>= 6.1' spec.add_dependency 'concurrent-ruby' end diff --git a/gemfiles/rails_5_2.gemfile b/gemfiles/rails_5_2.gemfile deleted file mode 100644 index da3da842..00000000 --- a/gemfiles/rails_5_2.gemfile +++ /dev/null @@ -1,18 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionmailer", "~> 5.2.0" -gem "activejob", "~> 5.2.0" -gem "activerecord", "~> 5.2.0" -gem "appraisal" -gem "betterlint" -gem "mysql2" -gem "pg" -gem "rake" -gem "rspec" -gem "sqlite3" -gem "timecop" -gem "zeitwerk" - -gemspec path: "../" diff --git a/gemfiles/rails_6_0.gemfile b/gemfiles/rails_6_0.gemfile deleted file mode 100644 index bff971b3..00000000 --- a/gemfiles/rails_6_0.gemfile +++ /dev/null @@ -1,18 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionmailer", "~> 6.0.0" -gem "activejob", "~> 6.0.0" -gem "activerecord", "~> 6.0.0" -gem "appraisal" -gem "betterlint" -gem "mysql2" -gem "pg" -gem "rake" -gem "rspec" -gem "sqlite3" -gem "timecop" -gem "zeitwerk" - -gemspec path: "../" diff --git a/lib/delayed.rb b/lib/delayed.rb index 2fb97829..eacc7363 100644 --- a/lib/delayed.rb +++ b/lib/delayed.rb @@ -39,7 +39,7 @@ module Delayed autoload :PerformableMailer, 'delayed/performable_mailer' - mattr_accessor(:default_log_level) { 'info'.freeze } + mattr_accessor(:default_log_level) { 'info' } mattr_accessor(:plugins) do [ Delayed::Plugins::Instrumentation, diff --git a/lib/delayed/backend/base.rb b/lib/delayed/backend/base.rb index 62369bf2..75e3c3c6 100644 --- a/lib/delayed/backend/base.rb +++ b/lib/delayed/backend/base.rb @@ -55,7 +55,7 @@ def failed? end alias failed failed? - ParseObjectFromYaml = %r{!ruby/\w+:([^\s]+)}.freeze # rubocop:disable Naming/ConstantName + ParseObjectFromYaml = %r{!ruby/\w+:([^\s]+)} # rubocop:disable Naming/ConstantName def name # rubocop:disable Metrics/AbcSize @name ||= payload_object.job_data['job_class'] if payload_object.respond_to?(:job_data) diff --git a/lib/delayed/monitor.rb b/lib/delayed/monitor.rb index d2979693..98c13446 100644 --- a/lib/delayed/monitor.rb +++ b/lib/delayed/monitor.rb @@ -34,7 +34,7 @@ def run! attr_reader :jobs def emit_metric!(metric) - send("#{metric}_grouped").reverse_merge(default_results).each do |(priority, queue), value| + send(:"#{metric}_grouped").reverse_merge(default_results).each do |(priority, queue), value| ActiveSupport::Notifications.instrument( "delayed.job.#{metric}", default_tags.merge(priority: Priority.new(priority).to_s, queue: queue, value: value), diff --git a/lib/delayed/performable_method.rb b/lib/delayed/performable_method.rb index 8b6d46d9..2afb47e2 100644 --- a/lib/delayed/performable_method.rb +++ b/lib/delayed/performable_method.rb @@ -26,7 +26,7 @@ def display_name def perform return unless object - if kwargs.nil? || (RUBY_VERSION < '2.7' && kwargs.empty?) + if kwargs.nil? object.send(method_name, *args) else object.send(method_name, *args, **kwargs)