moove-it/sidekiq-scheduler

View on GitHub
lib/sidekiq-scheduler/scheduler.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class Scheduler has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Scheduler
    # We expect rufus jobs to have #params
    Rufus::Scheduler::Job.module_eval do
      alias_method :params, :opts
    end
Severity: Minor
Found in lib/sidekiq-scheduler/scheduler.rb - About 3 hrs to fix

    Method load_schedule! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def load_schedule!
          if enabled
            Sidekiq.logger.info 'Loading Schedule'
    
            # Load schedule from redis for the first time if dynamic
    Severity: Minor
    Found in lib/sidekiq-scheduler/scheduler.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method load_schedule_job has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def load_schedule_job(name, config)
          # If rails_env is set in the config, enforce ENV['RAILS_ENV'] as
          # required for the jobs to be scheduled.  If rails_env is missing, the
          # job should be scheduled regardless of what ENV['RAILS_ENV'] is set
          # to.
    Severity: Minor
    Found in lib/sidekiq-scheduler/scheduler.rb - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method new_job has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def new_job(name, interval_type, config, schedule, options)
    Severity: Minor
    Found in lib/sidekiq-scheduler/scheduler.rb - About 35 mins to fix

      There are no issues that match your filters.

      Category
      Status