SciRuby/statsample

View on GitHub

Showing 95 of 133 total issues

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

    def iterate(m=nil)
      @clean=false
      m||=@m
      @m=m
      t = @max_iterations
Severity: Minor
Found in lib/statsample/factor/principalaxis.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 constant_se has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def constant_se
    return nil if @no_covariance
    means=@x_mean
    #means[@y_var]=@y_mean
    means[:constant]=1
Severity: Minor
Found in lib/statsample/regression/multiple/matrixengine.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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(matrix,y_var, opts=Hash.new)
    matrix.extend Statsample::CovariateMatrix
    raise "#{y_var} variable should be on data" unless matrix.fields.include? y_var
    if matrix._type==:covariance
      @matrix_cov=matrix
Severity: Minor
Found in lib/statsample/regression/multiple/matrixengine.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 init_gsl has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def init_gsl(a,b,cov00, cov01, covx1, chisq, status)
Severity: Major
Found in lib/statsample/regression/simple.rb - About 50 mins to fix

    Method initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def initialize(opts=Hash.new)
            @name=@name_numerator=@name_denominator=nil
            
            # First see if sum of squares or mean squares are entered
            raise ArgumentError, "You should set d.f." unless (opts.has_key? :df_num and opts.has_key? :df_den)
    Severity: Minor
    Found in lib/statsample/anova/oneway.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 conditional_dominance_pairwise has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def conditional_dominance_pairwise(i,j)
          dm=dominance_for_nil_model(i,j)
          return 0.5 if dm==0.5
          dominances=[dm]
          for k in 1...@predictors.size
    Severity: Minor
    Found in lib/statsample/dominanceanalysis.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 nice has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.nice(s, e) # :nodoc:
          reverse = e < s
          min = reverse ? e : s
          max = reverse ? s : e
          span = max - min
    Severity: Minor
    Found in lib/statsample.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 increment has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def increment(x, w=1)
          if x.respond_to? :each
            x.each{|y| increment(y,w) }
          elsif x.is_a? Numeric
            (range.size - 1).times do |i|
    Severity: Minor
    Found in lib/statsample/histogram.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 report_building has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def report_building(b)
              di="%0.#{digits}f"
              b.section(:name=>@name) do |g|
                c=coeffs
                g.text _("Engine: %s") % self.class
    Severity: Minor
    Found in lib/statsample/regression/multiple/baseengine.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 p_using_cdf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def p_using_cdf(cdf, tails=:both)
          tails=:both if tails==2 or tails==:two
          tails=:right if tails==1 or tails==:positive
          tails=:left if tails==:negative
          case tails
    Severity: Minor
    Found in lib/statsample/test.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 separate_matrices has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.separate_matrices(matrix, y)
          ac=[]
          matrix.column_size.times do |i|
            ac.push(matrix[y,i]) if i!=y
          end
    Severity: Minor
    Found in lib/statsample/factor/principalaxis.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 table_percentage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def table_percentage(generator,type)
          fq=frequencies
          cn=cols_names
          rn=rows_names
          rt=rows_total
    Severity: Minor
    Found in lib/statsample/crosstab.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 mean_confidence_interval_t has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def mean_confidence_interval_t(mean,s,n_sample,n_population,margin=0.95)
    Severity: Minor
    Found in lib/statsample/srs.rb - About 35 mins to fix

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

            def mean_confidence_interval_z(mean,s,n_sample,n_population,margin=0.95)
      Severity: Minor
      Found in lib/statsample/srs.rb - About 35 mins to fix

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

              def mean_confidence_interval(mean,s,n_sample,n_population,x)
        Severity: Minor
        Found in lib/statsample/srs.rb - About 35 mins to fix

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

                  def residuals
                    Daru::Vector.new(
                      (0...@total_cases).collect do |i|
                        invalid=false
                        vect=@dep_columns.collect{|v| invalid=true if v[i].nil?; v[i]}
          Severity: Minor
          Found in lib/statsample/regression/multiple/baseengine.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 correlation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def correlation
                if(_type==:covariance)
                  matrix=Matrix.rows(row_size.times.collect { |i|
                    column_size.times.collect { |j|
                      if i==j
          Severity: Minor
          Found in lib/statsample/matrix.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 report_building has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                def report_building(builder) # :nodoc:
                  builder.section(:name=>@name) do |s|
                    if summary_descriptives
                      s.table(:name=>_("Descriptives"),:header=>%w{Name N Mean SD Min Max}.map {|v| _(v)}) do |t|
                        @vectors.each do |v|
          Severity: Minor
          Found in lib/statsample/anova/oneway.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 variable_definition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                      def variable_definition(carrier,v,name,nickname=nil)
                          nickname = (nickname.nil? ? "" : "nickname=\"#{nickname}\"" )
                          if v.type==:object or v.to_a.find {|d|  d.is_a? String }
                              carrier.categorials.push(name)
                              carrier.conversions[name]={}
          Severity: Minor
          Found in lib/statsample/converters.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def initialize(matrix, opts=Hash.new)
                @matrix=matrix
                if @matrix.respond_to? :fields
                  @fields=@matrix.fields
                else
          Severity: Minor
          Found in lib/statsample/factor/principalaxis.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

          Severity
          Category
          Status
          Source
          Language