joekhoobyar/shoryuken-later

View on GitHub
lib/shoryuken/later/cli.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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 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

    There are no issues that match your filters.

    Category
    Status