dry-rb/dry-monads

View on GitHub

Showing 6 of 206 total issues

Class List has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

    class List
      class << self
        # Builds a list.
        #
        # @param values [Array<Object>] List elements
Severity: Minor
Found in lib/dry/monads/list.rb - About 3 hrs to fix

    Class Task has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Task
          # @api private
          class Promise < Concurrent::Promise
            public :on_fulfill, :on_reject
          end
    Severity: Minor
    Found in lib/dry/monads/task.rb - About 2 hrs to fix

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

            def collect
              if block_given?
                collected = value.each_with_object([]) do |x, ys|
                  y = yield(x)
                  ys << y.value! if y.some?
      Severity: Minor
      Found in lib/dry/monads/list.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 bind has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def bind(*args, **kwargs)
                if args.empty? && !kwargs.empty?
                  vargs, vkwargs = destructure(@value)
                  kw = [kwargs.merge(vkwargs)]
                else
      Severity: Minor
      Found in lib/dry/monads/right_biased.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 coerce has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def coerce(value, type = nil)
                if value.nil?
                  List.new([], type)
                elsif value.respond_to?(:to_ary)
                  values = value.to_ary
      Severity: Minor
      Found in lib/dry/monads/list.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.call(value)
              func = value.is_a?(Proc) ? value : value.method(:call)
              seq_args = func.parameters.count { |type, _| type == :req || type == :opt }
              seq_args += 1 if func.parameters.any? { |type, _| type == :keyreq }
      
      
      Severity: Minor
      Found in lib/dry/monads/curry.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