bolshakov/fear

View on GitHub

Showing 3 of 3 total issues

Class Future has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Future
    include Awaitable

    # @param promise [nil, Concurrent::Future] converts
    #  +Concurrent::Promise+ into +Fear::Future+.
Severity: Minor
Found in lib/fear/future.rb - About 2 hrs to fix

    Method zip has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def zip(other)
          if other.is_a?(Option)
            other.map do |x|
              if block_given?
                yield(value, x)
    Severity: Minor
    Found in lib/fear/some.rb - About 25 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 zip has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def zip(other)
          promise = Promise.new(**@options)
          on_complete_match do |m|
            m.success do |value|
              other.on_complete do |other_try|
    Severity: Minor
    Found in lib/fear/future.rb - About 25 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