RobertDober/lab42_streams

View on GitHub

Showing 5 of 5 total issues

Class Stream has 38 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Stream
    IllegalState = Class.new RuntimeError

    module Enumerable

Severity: Minor
Found in lib/lab42/stream/enumerable.rb - About 5 hrs to fix

    Method ordered_by has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def ordered_by beh
    
        sort do | a, b |
          a == b ? 0 : (
            beh.(a, b) ? -1 : 1
    Severity: Minor
    Found in lib/lab42/stream/core/enumerable.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 __inject_while__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def __inject_while__ ival, cond, red
            raise ConstraintError unless cond.(ival)
            s = self
            loop do
              new_val = red.(ival, s.head)
    Severity: Minor
    Found in lib/lab42/stream/enumerable.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 __flatmap_with_each__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def __flatmap_with_each__ a_proc, rest_of_enum = []
            # Process expanded values
            return cons_stream( rest_of_enum.first ){ __flatmap_with_each__ a_proc, rest_of_enum.drop( 1 ) } unless
            rest_of_enum.empty?
    
    
    Severity: Minor
    Found in lib/lab42/stream/enumerable.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 force_all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def force_all cache={}
            x = []
            each_without_loops do | ele |
              if self.class === ele
                if ! cache[ele.object_id]
    Severity: Minor
    Found in lib/lab42/stream/enumerable.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