inertia186/drotto

View on GitHub
lib/drotto.rb

Summary

Maintainability
D
1 day
Test Coverage

Method process_bid has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

  def process_bid(options = {})
    job = options[:job]
    id = options[:id]
    tx = options[:tx] || job.transfer(id)
    timestamp = options[:timestamp]
Severity: Minor
Found in lib/drotto.rb - About 7 hrs 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_bid has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def process_bid(options = {})
    job = options[:job]
    id = options[:id]
    tx = options[:tx] || job.transfer(id)
    timestamp = options[:timestamp]
Severity: Minor
Found in lib/drotto.rb - About 2 hrs to fix

    Method find_bids has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def find_bids(offset = BLOCK_OVERLAP)
        block_num = head_block
        time = block_time
        starting_block = block_num - block_span(offset)
        bids = []
    Severity: Minor
    Found in lib/drotto.rb - About 1 hr to fix

      Method find_bids has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def find_bids(offset = BLOCK_OVERLAP)
          block_num = head_block
          time = block_time
          starting_block = block_num - block_span(offset)
          bids = []
      Severity: Minor
      Found in lib/drotto.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 join_threads has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def join_threads
          unless @threads.nil?
            loop do
              alive = @threads.map do |thread|
                thread if thread.alive?
      Severity: Minor
      Found in lib/drotto.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

      There are no issues that match your filters.

      Category
      Status