Skip to content

Commit

Permalink
rubocop cleanup ruby 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
onyxraven committed Oct 14, 2024
1 parent 6cd37a1 commit 10117b8
Show file tree
Hide file tree
Showing 47 changed files with 62 additions and 142 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ on:
jobs:
rubocop:
name: Rubocop
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
ruby: [
2.7
]
ruby:
- "3.0"
- "3.1"
- "3.2"
- "3.3"

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.7
NewCops: enable
Include:
- Gemfile
- '**/Rakefile'
Expand Down
75 changes: 15 additions & 60 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,26 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2016-06-26 12:36:38 -0400 using RuboCop version 0.40.0.
# on 2024-10-14 18:26:36 UTC using RuboCop version 0.92.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
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Exclude:
- 'lib/resque/scheduler/env.rb'

# Offense count: 2
Lint/UselessAccessModifier:
Exclude:
- 'lib/resque/scheduler.rb'

# Offense count: 17
Metrics/AbcSize:
Max: 36

# Offense count: 3
Metrics/CyclomaticComplexity:
Max: 12

# Offense count: 6
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
# URISchemes: http, https
Metrics/LineLength:
Max: 96

# Offense count: 20
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 34

# Offense count: 2
# Configuration parameters: CountComments.
Metrics/ModuleLength:
Max: 364

# Offense count: 1
Style/CaseEquality:
Exclude:
- 'lib/resque/scheduler.rb'

# Offense count: 1
Style/EachWithObject:
Exclude:
- 'lib/resque/scheduler.rb'

# Offense count: 3
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts.
Style/FileName:
Exclude:
- 'examples/config/initializers/resque-web.rb'
- 'lib/resque-scheduler.rb'
- 'test/resque-web_test.rb'

# Offense count: 1
# Configuration parameters: MinBodyLength.
Style/GuardClause:
# Configuration parameters: Include.
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
Bundler/DuplicatedGem:
Exclude:
- 'lib/resque/scheduler/lock/basic.rb'
- 'Gemfile'

# Offense count: 1
Style/IfInsideElse:
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'lib/resque/scheduler.rb'
- 'Gemfile'
- 'Rakefile'
- 'examples/Rakefile'
- 'exe/resque-scheduler'
- 'resque-scheduler.gemspec'
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim:fileencoding=utf-8
source 'https://rubygems.org'

case resque_version = ENV.fetch('RESQUE', 'latest')
Expand Down
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim:fileencoding=utf-8
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'yard'
Expand Down
2 changes: 0 additions & 2 deletions bin/migrate_to_timestamps_set.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

require 'redis'
require 'resque'

Expand Down
1 change: 0 additions & 1 deletion examples/Rakefile
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# vim:fileencoding=utf-8
require 'resque/scheduler/tasks'
2 changes: 0 additions & 2 deletions examples/config/initializers/resque-web.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

require 'json'
require 'yaml'
require 'resque'
Expand Down
1 change: 0 additions & 1 deletion examples/dynamic-scheduling/app/jobs/fix_schedules_job.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim:fileencoding=utf-8
#
# Background job to fix the schedule for email sending. Any missing
# schedule will be added to resque-schedule.
Expand Down
2 changes: 0 additions & 2 deletions examples/dynamic-scheduling/app/jobs/send_email_job.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

class SendEmailJob
@queue = :send_emails

Expand Down
2 changes: 0 additions & 2 deletions examples/dynamic-scheduling/app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

class User < ActiveRecord::Base
after_create :schedule_send_email

Expand Down
2 changes: 0 additions & 2 deletions examples/dynamic-scheduling/lib/tasks/resque.rake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

require 'resque/tasks'
require 'resque/scheduler/tasks'
require 'yaml'
Expand Down
1 change: 0 additions & 1 deletion exe/resque-scheduler
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env ruby
# vim:fileencoding=utf-8

require 'resque-scheduler'
Resque::Scheduler::Cli.run!
1 change: 0 additions & 1 deletion lib/resque-scheduler.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim:fileencoding=utf-8
require_relative 'resque/scheduler'

Resque.extend Resque::Scheduler::Extension
2 changes: 0 additions & 2 deletions lib/resque/scheduler.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

require 'redis/errors'
require 'rufus/scheduler'
require_relative 'scheduler/configuration'
Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/cli.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

require 'optparse'

module Resque
Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

module Resque
module Scheduler
module Configuration
Expand Down
1 change: 0 additions & 1 deletion lib/resque/scheduler/delaying_extensions.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim:fileencoding=utf-8
require 'resque'
require_relative 'plugin'
require_relative '../scheduler'
Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/env.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

require 'English' # $PROCESS_ID

module Resque
Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/extension.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

require_relative 'scheduling_extensions'
require_relative 'delaying_extensions'

Expand Down
1 change: 0 additions & 1 deletion lib/resque/scheduler/lock.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim:fileencoding=utf-8
%w(base basic resilient).each do |file|
require "resque/scheduler/lock/#{file}"
end
2 changes: 0 additions & 2 deletions lib/resque/scheduler/lock/base.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

module Resque
module Scheduler
module Lock
Expand Down
1 change: 0 additions & 1 deletion lib/resque/scheduler/lock/basic.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim:fileencoding=utf-8
require_relative 'base'

module Resque
Expand Down
1 change: 0 additions & 1 deletion lib/resque/scheduler/lock/resilient.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim:fileencoding=utf-8
require_relative 'base'

module Resque
Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/locking.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

# ### Locking the scheduler process
#
# There are two places in resque-scheduler that need to be synchronized in order
Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/logger_builder.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

require 'mono_logger'

module Resque
Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/plugin.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

module Resque
module Scheduler
module Plugin
Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/scheduling_extensions.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

module Resque
module Scheduler
module SchedulingExtensions
Expand Down
1 change: 0 additions & 1 deletion lib/resque/scheduler/server.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim:fileencoding=utf-8
require 'resque-scheduler'
require 'resque/server'
require 'tilt/erb'
Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/signal_handling.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

module Resque
module Scheduler
module SignalHandling
Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/tasks.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

require 'resque/tasks'
require 'resque-scheduler'

Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/util.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

module Resque
module Scheduler
class Util
Expand Down
2 changes: 0 additions & 2 deletions lib/resque/scheduler/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# vim:fileencoding=utf-8

module Resque
module Scheduler
VERSION = '4.10.2'.freeze
Expand Down
20 changes: 10 additions & 10 deletions resque-scheduler.gemspec
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
# vim:fileencoding=utf-8
lib = File.expand_path('../lib', __FILE__)
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'resque/scheduler/version'

Gem::Specification.new do |spec|
spec.name = 'resque-scheduler'
spec.version = Resque::Scheduler::VERSION
spec.authors = <<-EOF.split(/\n/).map(&:strip)
spec.authors = <<-AUTHORS.split(/\n/).map(&:strip)
Ben VandenBos
Simon Eskildsen
Ryan Biesemeyer
Dan Buch
Michael Bianco
Patrick Tulskie
EOF
spec.email = %w(
AUTHORS
spec.email = %w[
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
)
]
spec.summary = 'Light weight job scheduling on top of Resque'
spec.description = <<-DESCRIPTION
Light weight job scheduling on top of Resque.
Expand All @@ -32,7 +31,7 @@ Gem::Specification.new do |spec|
spec.license = 'MIT'
spec.metadata['rubygems_mfa_required'] = 'true'

spec.required_ruby_version = '>= 2.3.0'
spec.required_ruby_version = '>= 2.7.0'

spec.files = `git ls-files -z`.split("\0").reject do |f|
f.match(%r{^(test|spec|features|examples|bin|tasks)/}) ||
Expand All @@ -41,7 +40,7 @@ Gem::Specification.new do |spec|
end
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = %w(lib)
spec.require_paths = %w[lib]

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'json'
Expand All @@ -52,12 +51,13 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rake'
spec.add_development_dependency 'simplecov'
spec.add_development_dependency 'test-unit'
spec.add_development_dependency 'yard'
spec.add_development_dependency 'timecop'
spec.add_development_dependency 'yard'

# We pin rubocop because new cops have a tendency to result in false-y
# positives for new contributors, which is not a nice experience.
spec.add_development_dependency 'rubocop', '~> 0.40.0'
spec.add_development_dependency 'racc'
spec.add_development_dependency 'rubocop', '~> 0.92.0'

spec.add_runtime_dependency 'mono_logger', '~> 1.0'
spec.add_runtime_dependency 'redis', '>= 3.3'
Expand Down
1 change: 0 additions & 1 deletion test/cli_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim:fileencoding=utf-8
require_relative 'test_helper'

context 'Cli' do
Expand Down
1 change: 0 additions & 1 deletion test/configuration_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# vim:fileencoding=utf-8
require_relative 'test_helper'

context 'Configuration' do
Expand Down
Loading

0 comments on commit 10117b8

Please sign in to comment.