rubinius/rubinius

View on GitHub
core/enumerable.rb

Summary

Maintainability
F
1 wk
Test Coverage

File enumerable.rb has 709 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Enumerable
  def chunk
    raise ArgumentError, "no block given" unless block_given?
    ::Enumerator.new do |yielder|
      previous = nil
Severity: Major
Found in core/enumerable.rb - About 1 day to fix

    Method chunk has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

      def chunk
        raise ArgumentError, "no block given" unless block_given?
        ::Enumerator.new do |yielder|
          previous = nil
          accumulate = []
    Severity: Minor
    Found in core/enumerable.rb - About 4 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 min has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def min(n=nil)
        if n.nil?
          min = undefined
          each do
            element = Rubinius.single_block_arg
    Severity: Minor
    Found in core/enumerable.rb - About 3 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 max has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

      def max(n=nil)
        if n.nil?
          max = undefined
          each do
            element = Rubinius.single_block_arg
    Severity: Minor
    Found in core/enumerable.rb - About 3 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 minmax has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

      def minmax(&block)
        block = Enumerable.sort_proc unless block
        first_time = true
        min, max = nil
    
    
    Severity: Minor
    Found in core/enumerable.rb - About 2 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 one? has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def one?
        found_one = false
    
        if block_given?
          each do |*element|
    Severity: Minor
    Found in core/enumerable.rb - About 2 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 inject has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def inject(initial=undefined, sym=undefined)
        if !block_given? or !undefined.equal?(sym)
          if undefined.equal?(sym)
            sym = initial
            initial = undefined
    Severity: Minor
    Found in core/enumerable.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 slice_before has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      def slice_before(pattern = undefined, &block)
        pattern_given = !(undefined.equal? pattern)
    
        raise ArgumentError, "cannot pass both pattern and block" if pattern_given && block_given?
        raise ArgumentError, "a pattern or a block must be provided" if !pattern_given && !block_given?
    Severity: Minor
    Found in core/enumerable.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 cycle has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def cycle(many=nil)
        unless block_given?
          return to_enum(:cycle, many) do
            Rubinius::EnumerableHelper.cycle_size(enumerator_size, many)
          end
    Severity: Minor
    Found in core/enumerable.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 each_cons has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def each_cons(num)
        n = Rubinius::Type.coerce_to_collection_index num
        raise ArgumentError, "invalid size: #{n}" if n <= 0
    
        unless block_given?
    Severity: Minor
    Found in core/enumerable.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 zip has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

      def zip(*args)
        args.map! do |a|
          if a.respond_to? :to_ary
            a.to_ary
          else
    Severity: Minor
    Found in core/enumerable.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 each_slice has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def each_slice(slice_size)
        n = Rubinius::Type.coerce_to_collection_index slice_size
        raise ArgumentError, "invalid slice size: #{n}" if n <= 0
    
        unless block_given?
    Severity: Minor
    Found in core/enumerable.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 slice_after has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def slice_after(pattern = undefined, &block)
        pattern_given = !undefined.equal?(pattern)
    
        raise ArgumentError, "cannot pass both pattern and block" if pattern_given && block_given?
        raise ArgumentError, "a pattern or a block must be provided" if !pattern_given && !block_given?
    Severity: Minor
    Found in core/enumerable.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 find_index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def find_index(value=undefined)
        if undefined.equal? value
          return to_enum(:find_index) unless block_given?
    
          i = 0
    Severity: Minor
    Found in core/enumerable.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 cycle has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def cycle(many=nil)
        unless block_given?
          return to_enum(:cycle, many) do
            Rubinius::EnumerableHelper.cycle_size(enumerator_size, many)
          end
    Severity: Minor
    Found in core/enumerable.rb - About 1 hr to fix

      Method zip has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def zip(*args)
          args.map! do |a|
            if a.respond_to? :to_ary
              a.to_ary
            else
      Severity: Minor
      Found in core/enumerable.rb - About 1 hr to fix

        Method chunk has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def chunk
            raise ArgumentError, "no block given" unless block_given?
            ::Enumerator.new do |yielder|
              previous = nil
              accumulate = []
        Severity: Minor
        Found in core/enumerable.rb - About 1 hr to fix

          Method slice_when has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def slice_when(&block)
              raise ArgumentError, "wrong number of arguments (0 for 1)" unless block_given?
          
              Enumerator.new do |enum|
                ary = nil
          Severity: Minor
          Found in core/enumerable.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 all? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def all?
              if block_given?
                each { |*element| return false unless yield(*element) }
              else
                each { return false unless Rubinius.single_block_arg }
          Severity: Minor
          Found in core/enumerable.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 count has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def count(item = undefined)
              seq = 0
              if !undefined.equal?(item)
                each do
                  element = Rubinius.single_block_arg
          Severity: Minor
          Found in core/enumerable.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 min_by has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def min_by(n=nil)
              return to_enum(:min_by, n) { enumerator_size } unless block_given?
          
              if n.nil?
                min_element = nil
          Severity: Minor
          Found in core/enumerable.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 none? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def none?
              if block_given?
                each { |*element| return false if yield(*element) }
              else
                each { return false if Rubinius.single_block_arg }
          Severity: Minor
          Found in core/enumerable.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 max_by has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def max_by(n=nil)
              return to_enum(:max_by, n) { enumerator_size } unless block_given?
          
              if n.nil?
                max_element = nil
          Severity: Minor
          Found in core/enumerable.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 any? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def any?
              if block_given?
                each { |*element| return true if yield(*element) }
              else
                each { return true if Rubinius.single_block_arg }
          Severity: Minor
          Found in core/enumerable.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 take has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def take(n)
              n = Rubinius::Type.coerce_to_collection_index n
              raise ArgumentError, "attempt to take negative size: #{n}" if n < 0
          
              array = []
          Severity: Minor
          Found in 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 minmax_by has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def minmax_by(&block)
              return to_enum(:minmax_by) { enumerator_size } unless block_given?
          
              min_element = nil
              min_result = undefined
          Severity: Minor
          Found in 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 flat_map has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def flat_map
              return to_enum(:flat_map) { enumerator_size } unless block_given?
          
              array = []
              each do |*element|
          Severity: Minor
          Found in core/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 drop_while has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def drop_while
              return to_enum(:drop_while) unless block_given?
          
              ary = []
              dropping = true
          Severity: Minor
          Found in core/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 grep has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def grep(pattern)
              ary = []
          
              each do
                element = Rubinius.single_block_arg
          Severity: Minor
          Found in core/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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                min = undefined
                each do
                  element = Rubinius.single_block_arg
                  if undefined.equal? min
                    min = element
          Severity: Major
          Found in core/enumerable.rb and 1 other location - About 1 hr to fix
          core/enumerable.rb on lines 622..640

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 51.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                max = undefined
                each do
                  element = Rubinius.single_block_arg
                  if undefined.equal? max
                    max = element
          Severity: Major
          Found in core/enumerable.rb and 1 other location - About 1 hr to fix
          core/enumerable.rb on lines 593..611

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 51.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                max_element = nil
                max_result = undefined
          
                each do
                  element = Rubinius.single_block_arg
          Severity: Minor
          Found in core/enumerable.rb and 1 other location - About 30 mins to fix
          core/enumerable.rb on lines 677..691

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 32.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                min_element = nil
                min_result = undefined
          
                each do
                  element = Rubinius.single_block_arg
          Severity: Minor
          Found in core/enumerable.rb and 1 other location - About 30 mins to fix
          core/enumerable.rb on lines 653..667

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 32.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          There are no issues that match your filters.

          Category
          Status