joekhoobyar/shoryuken-later

View on GitHub

Showing 7 of 7 total issues

Method parse_options has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parse_options(argv)
        opts = {later: {}}

        @parser = OptionParser.new do |o|
          o.on '-d', '--daemon', 'Daemonize process' do |arg|
Severity: Minor
Found in lib/shoryuken/later/cli.rb - About 1 hr to fix

    Method daemonize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def daemonize
            return unless Shoryuken::Later.options[:daemon]
    
            raise ArgumentError, "You really should set a logfile if you're going to daemonize" unless Shoryuken::Later.options[:logfile]
    
    
    Severity: Minor
    Found in lib/shoryuken/later/cli.rb - About 55 mins 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 setup_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def setup_options(args)
            options = parse_options(args)
    
            # yield parsed options in case we need to do more setup before configuration is parsed
            yield(options) if block_given?
    Severity: Minor
    Found in lib/shoryuken/later/cli.rb - About 55 mins 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 process_item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def process_item(item)
            time, worker_class, args, id = item.values_at('perform_at','shoryuken_class','shoryuken_args','id')
            
            worker_class = worker_class.constantize
            args = JSON.parse(args)
    Severity: Minor
    Found in lib/shoryuken/later/poller.rb - About 45 mins 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 poll has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def poll
            watchdog('Later::Poller#poll died') do
              started_at = Time.now
              
              logger.debug { "Polling for scheduled messages in '#{table_name}'" }
    Severity: Minor
    Found in lib/shoryuken/later/poller.rb - About 45 mins 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 validate! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def validate!
            raise ArgumentError, 'No tables given to poll' if Shoryuken::Later.tables.empty?
    
            if Shoryuken::Later.options[:aws][:access_key_id].nil? && Shoryuken::Later.options[:aws][:secret_access_key].nil?
              if ENV['AWS_ACCESS_KEY_ID'].nil? && ENV['AWS_SECRET_ACCESS_KEY'].nil?
    Severity: Minor
    Found in lib/shoryuken/later/cli.rb - About 35 mins 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 perform_later has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def perform_later(time, body, options = {})
              time = Time.now + time.to_i if time.is_a?(Numeric)
              time = time.to_time if time.respond_to?(:to_time)
              raise ArgumentError, 'expected Numeric, Time but got '+time.class.name unless Time===time
              
    Severity: Minor
    Found in lib/shoryuken/later/worker.rb - About 35 mins 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

    Severity
    Category
    Status
    Source
    Language