SciRuby/nmatrix

View on GitHub
lib/nmatrix/jruby/slice.rb

Summary

Maintainability
D
2 days
Test Coverage

Method get_slice has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

  def get_slice(dim, args, shape_array)
    slice = {}
    slice[:coords]=[]
    slice[:lengths]=[]
    slice[:single] = true
Severity: Minor
Found in lib/nmatrix/jruby/slice.rb - About 5 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 get_slice has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def get_slice(dim, args, shape_array)
    slice = {}
    slice[:coords]=[]
    slice[:lengths]=[]
    slice[:single] = true
Severity: Minor
Found in lib/nmatrix/jruby/slice.rb - About 1 hr to fix

    Method dense_storage_get has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def dense_storage_get(slice,stride)
        if slice[:single]
          return dense_storage_pos(slice[:coords],stride)
        else
          shape = @shape.dup
    Severity: Minor
    Found in lib/nmatrix/jruby/slice.rb - About 1 hr to fix

      Method dense_storage_set has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def dense_storage_set(slice, right)
          stride = get_stride(self)
          v_size = 1
      
          if right.is_a?(NMatrix)
      Severity: Minor
      Found in lib/nmatrix/jruby/slice.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 dense_storage_set has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def dense_storage_set(slice, right)
          stride = get_stride(self)
          v_size = 1
      
          if right.is_a?(NMatrix)
      Severity: Minor
      Found in lib/nmatrix/jruby/slice.rb - About 1 hr to fix

        Method dense_storage_get has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def dense_storage_get(slice,stride)
            if slice[:single]
              return dense_storage_pos(slice[:coords],stride)
            else
              shape = @shape.dup
        Severity: Minor
        Found in lib/nmatrix/jruby/slice.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_set has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def slice_set(dest, lengths, pdest, rank, v, v_size, v_offset)
            if (dim - rank > 1)
              (0...lengths[rank]).each do |i|
                slice_set(dest, lengths, pdest + dest[:stride][rank] * i, rank + 1, v, v_size, v_offset);
              end
        Severity: Minor
        Found in lib/nmatrix/jruby/slice.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 xslice has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def xslice(args)
            result = nil
        
            if self.dim < args.length
              raise(ArgumentError,"wrong number of arguments (#{args} for #{effective_dim(self)})")
        Severity: Minor
        Found in lib/nmatrix/jruby/slice.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 xslice_ref has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def xslice_ref(args)
            result = nil
        
            if self.dim < args.length
              raise(ArgumentError,"wrong number of arguments (#{args} for #{effective_dim(self)})")
        Severity: Minor
        Found in lib/nmatrix/jruby/slice.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 slice_set has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def slice_set(dest, lengths, pdest, rank, v, v_size, v_offset)
        Severity: Major
        Found in lib/nmatrix/jruby/slice.rb - About 50 mins to fix

          Method slice_copy has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def slice_copy(src, dest,lengths, pdest, psrc,n)
          Severity: Minor
          Found in lib/nmatrix/jruby/slice.rb - About 45 mins to fix

            Method dense_storage_coords has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def dense_storage_coords(s, slice_pos, coords_out, stride, offset)  #array, int, array
            Severity: Minor
            Found in lib/nmatrix/jruby/slice.rb - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status