SciRuby/nmatrix

View on GitHub

Showing 130 of 196 total issues

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 repacked_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def repacked_data(to_dtype = nil)
    
            real_mdtype = self.real_part.tag.data_type
    
            # Figure out what dtype to use based on the MATLAB data-types
    Severity: Minor
    Found in lib/nmatrix/io/mat5_reader.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 read_entry has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def read_entry f, entry, assign=nil, convert=nil
          assign ||= (entry.to_s + "=").to_sym
    
          while line = f.gets
            next if line =~ /^\s*#/ # ignore comment lines
    Severity: Minor
    Found in lib/nmatrix/io/point_cloud.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 det has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def det
        raise(ShapeError, "determinant can be calculated only for square matrices") unless self.dim == 2 && self.shape[0] == self.shape[1]
    
        # Cast to a dtype for which getrf is implemented
        new_dtype = self.integer_dtype? ? :float64 : self.dtype
    Severity: Minor
    Found in lib/nmatrix/cruby/math.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_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 read_packed has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def read_packed(packedio, options)
            raise(ArgumentError, 'Missing mandatory option :endian.') \
             unless options.has_key?(:endian)
    
            tag = packedio.read([Tag, {:endian => options[:endian]}])
    Severity: Minor
    Found in lib/nmatrix/io/mat5_reader.rb - About 1 hr to fix

      Method header has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def header
                return @header if !@header.empty?
                @file = File.open @file_name, "r"
      
                line = @file.gets
      Severity: Minor
      Found in lib/nmatrix/io/harwell_boeing.rb - About 1 hr to fix

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

          def concat(*matrices)
            rank = nil
            rank = matrices.pop unless matrices.last.is_a?(NMatrix)
        
            # Find the first matching dimension and concatenate along that (unless rank is specified)
        Severity: Minor
        Found in lib/nmatrix/nmatrix.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 posv has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

              def posv(uplo, a, b)
                raise(ShapeError, "a must be square") unless a.dim == 2 && a.shape[0] == a.shape[1]
                raise(ShapeError, "number of rows of b must equal number of cols of a") unless a.shape[1] == b.shape[0]
                raise(StorageTypeError, "only works with dense matrices") unless a.stype == :dense && b.stype == :dense
                raise(DataTypeError, "only works for non-integer, non-object dtypes") if 
        Severity: Minor
        Found in lib/nmatrix/lapacke.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 =~ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def =~ (other)
            lha = @s.toArray.to_a
            rha = other.s.toArray.to_a
            resultArray = Array.new(lha.length)
            if (other.is_a?(NMatrix))
        Severity: Minor
        Found in lib/nmatrix/jruby/nmatrix_java.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 < has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def < (other)
            lha = @s.toArray.to_a
            rha = other.s.toArray.to_a
            resultArray = Array.new(lha.length)
            if (other.is_a?(NMatrix))
        Severity: Minor
        Found in lib/nmatrix/jruby/nmatrix_java.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 posv has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

              def posv(uplo, a, b)
                raise(ShapeError, "a must be square") unless a.dim == 2 \
                 && a.shape[0] == a.shape[1]
        
                raise(ShapeError, "number of rows of b must equal number of cols of a") \
        Severity: Minor
        Found in lib/nmatrix/atlas.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 pinv has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def pinv(tolerance = 1e-15)
            raise DataTypeError, "pinv works only with matrices of float or complex data type" unless
              [:float32, :float64, :complex64, :complex128].include?(dtype)
            if self.complex_dtype?
              u, s, vt = self.complex_conjugate.gesvd # singular value decomposition
        Severity: Minor
        Found in lib/nmatrix/math.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 !~ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def !~ (other)
            lha = @s.toArray.to_a
            rha = other.s.toArray.to_a
            resultArray = Array.new(lha.length)
            if (other.is_a?(NMatrix))
        Severity: Minor
        Found in lib/nmatrix/jruby/nmatrix_java.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 is_symmetric has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def is_symmetric(hermitian)
            is_symmetric = true
        
            if (@shape[0] == @shape[1] and @dim == 2)
              if @stype == :dense
        Severity: Minor
        Found in lib/nmatrix/jruby/nmatrix_java.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 > has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def > (other)
            lha = @s.toArray.to_a
            rha = other.s.toArray.to_a
            resultArray = Array.new(lha.length)
            if (other.is_a?(NMatrix))
        Severity: Minor
        Found in lib/nmatrix/jruby/nmatrix_java.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 >= has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def >= (other)
            lha = @s.toArray.to_a
            rha = other.s.toArray.to_a
            resultArray = Array.new(lha.length)
            if (other.is_a?(NMatrix))
        Severity: Minor
        Found in lib/nmatrix/jruby/nmatrix_java.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 <= has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def <= (other)
            lha = @s.toArray.to_a
            rha = other.s.toArray.to_a
            resultArray = Array.new(lha.length)
            if (other.is_a?(NMatrix))
        Severity: Minor
        Found in lib/nmatrix/jruby/nmatrix_java.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 clapack_potrs has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def clapack_potrs(order, uplo, n, nrhs, a, lda, b, ldb)
        Severity: Major
        Found in lib/nmatrix/lapack_core.rb - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language