Skip to content

Commit

Permalink
Updates for updated rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
albus522 committed Mar 17, 2016
1 parent b16371b commit 401f43e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
14 changes: 13 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ AbcSize:
AccessModifierIndentation:
EnforcedStyle: outdent

Alias:
EnforcedStyle: prefer_alias_method

AllCops:
Include:
- 'Gemfile'
- 'Rakefile'
- 'delayed_job.gemspec'

RedundantBlockCall:
Enabled: false

# Avoid more than `Max` levels of nesting.
BlockNesting:
Max: 2
Expand Down Expand Up @@ -107,5 +113,11 @@ SpaceInsideHashLiteralBraces:
SymbolProc:
Enabled: false

TrailingComma:
TrailingCommaInLiteral:
Enabled: false

TrailingCommaInArguments:
Enabled: false

ZeroLengthPredicate:
Enabled: false
2 changes: 1 addition & 1 deletion lib/delayed/backend/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def work_off(num = 100)
attr_reader :error
def error=(error)
@error = error
self.last_error = "#{error.message}\n#{error.backtrace.join("\n")}" if self.respond_to?(:last_error=)
self.last_error = "#{error.message}\n#{error.backtrace.join("\n")}" if respond_to?(:last_error=)
end

def failed?
Expand Down
6 changes: 1 addition & 5 deletions lib/delayed/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ def parse_worker_pool(pool)
@worker_pools ||= []

queues, worker_count = pool.split(':')
if ['*', '', nil].include?(queues)
queues = []
else
queues = queues.split(',')
end
queues = ['*', '', nil].include?(queues) ? [] : queues.split(',')
worker_count = (worker_count || 1).to_i rescue 1
@worker_pools << [queues, worker_count]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/delayed/lifecycle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Lifecycle
:error => [:worker, :job],
:failure => [:worker, :job],
:invoke_job => [:job]
}
}.freeze

def initialize
@callbacks = EVENTS.keys.each_with_object({}) do |e, hash|
Expand Down
6 changes: 3 additions & 3 deletions lib/delayed/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

module Delayed
class Worker # rubocop:disable ClassLength
DEFAULT_LOG_LEVEL = 'info'
DEFAULT_LOG_LEVEL = 'info'.freeze
DEFAULT_SLEEP_DELAY = 5
DEFAULT_MAX_ATTEMPTS = 25
DEFAULT_MAX_RUN_TIME = 4.hours
DEFAULT_DEFAULT_PRIORITY = 0
DEFAULT_DELAY_JOBS = true
DEFAULT_QUEUES = []
DEFAULT_QUEUE_ATTRIBUTES = []
DEFAULT_QUEUES = [].freeze
DEFAULT_QUEUE_ATTRIBUTES = [].freeze
DEFAULT_READ_AHEAD = 5

cattr_accessor :min_priority, :max_priority, :max_attempts, :max_run_time,
Expand Down

0 comments on commit 401f43e

Please sign in to comment.