SciRuby/statsample

View on GitHub

Showing 95 of 133 total issues

Method tetrachoric_correlation_matrix has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def tetrachoric_correlation_matrix(ds)
        dsv=ds.reject_values(*Daru::MISSING_VALUES)
        # Delete all vectors doesn't have variation
        dsv.vectors.each { |f|
          if dsv[f].factors.size==1
Severity: Minor
Found in lib/statsample/converter/spss.rb - About 1 hr to fix

    Method iterate has 32 lines of code (exceeds 25 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 1 hr to fix

      Method report_building has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def report_building(b) # :nodoc:
              b.section(:name=>name) do |s|
                s.section(:name=>_("Reliability analysis of scales")) do |s2|
                  @scales.each_pair do |k, scale|
                    s2.parse_element(scale)
      Severity: Minor
      Found in lib/statsample/reliability/multiscaleanalysis.rb - About 1 hr to fix

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

              def rubyvis_panel # :nodoc:
                pre_vis
                #that=self
                
                @minimum_x||=@hist.min
        Severity: Minor
        Found in lib/statsample/graph/histogram.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 total_dominance_pairwise has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def total_dominance_pairwise(i,j)
              dm=dominance_for_nil_model(i,j)
              return 0.5 if dm==0.5
              dominances=[dm]
              models_data.each do |k,m|
        Severity: Minor
        Found in lib/statsample/dominanceanalysis.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 report_building has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def report_building(builder)
                builder.section(:name=>@name) do |s|
                  sa = scale_analysis
                  s.parse_element(sa)
                  if summary_show_problematic_items
        Severity: Minor
        Found in lib/statsample/reliability/skillscaleanalysis.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 initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def initialize(ds, opts=Hash.new)
                @dumped=ds.vectors.to_a.find_all {|f|
                  ds[f].variance == 0
                }
                
        Severity: Minor
        Found in lib/statsample/reliability/scaleanalysis.rb - About 1 hr to fix

          Method initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                    def initialize(ds,y_var, opts=Hash.new)
                      super
                      @ds          = ds.reject_values(*Daru::MISSING_VALUES)
                      @ds_valid    = @ds
                      @valid_cases = @ds_valid.nrows
          Severity: Minor
          Found in lib/statsample/regression/multiple/gslengine.rb - About 1 hr to fix

            Method write has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def write(dataset,filename,type=:covariance)
                    puts "Writing MX File"
                    File.open(filename,"w") do |fp|
                      fp.puts "! #{filename}"
                      fp.puts "! Output generated by Statsample"
            Severity: Minor
            Found in lib/statsample/converters.rb - About 1 hr to fix

              Method initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def initialize(input, dependent, opts=Hash.new)
                    @build_from_dataset=false
                    if dependent.is_a? Array
                      @regression_class= MULTIVARIATE_REGRESSION_CLASS
                      @method_association=:r2yx
              Severity: Minor
              Found in lib/statsample/dominanceanalysis.rb - About 1 hr to fix

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

                    def to_multiset_by_split_multiple_fields(*fields)
                      fields.map!(&:to_sym)
                      factors_total=nil
                      fields.each do |f|
                        if factors_total.nil?
                Severity: Minor
                Found in lib/statsample/daru.rb - About 1 hr to fix

                  Method initialize has 28 lines of code (exceeds 25 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 1 hr to fix

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

                          def _recode_dataset(dataset, h , sep=Statsample::SPLIT_TOKEN, split=false)
                            v_names||=h.keys
                            v_names.each do |v_name|
                              raise Exception, "Vector #{v_name} doesn't exists on Dataset" if !dataset.vectors.include? v_name
                              recoded = Daru::Vector.new(
                    Severity: Minor
                    Found in lib/statsample/codification.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 report_building has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def report_building(g) #:nodoc:
                            g.section(:name=>@name) do |s|
                              s.table(:name=>_("Eigenvalues"),:header=>[_("Value")]) do |t|
                                eigenvalues.each_with_index do |e,i|
                                    t.row([@errors.include?(i) ? "*" : "%0.6f" % e])
                    Severity: Minor
                    Found in lib/statsample/factor/map.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 kmo_univariate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.kmo_univariate(matrix, var)
                          if var.is_a? String
                            if matrix.respond_to? :fields
                              j=matrix.fields.index(var)
                              raise "Matrix doesn't have field #{var}" if j.nil?
                    Severity: Minor
                    Found in lib/statsample/factor.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 initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def initialize(matrix, opts=Hash.new)
                          @use_gsl = opts[:use_gsl]
                          opts.delete :use_gsl
                    
                          @name=_("Principal Component Analysis")
                    Severity: Minor
                    Found in lib/statsample/factor/pca.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 report_building has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def report_building(b) # :nodoc:
                            b.section(:name=>name) do |s|
                              s.section(:name=>_("Reliability analysis of scales")) do |s2|
                                @scales.each_pair do |k, scale|
                                  s2.parse_element(scale)
                    Severity: Minor
                    Found in lib/statsample/reliability/multiscaleanalysis.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 fix_with_regression has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def fix_with_regression
                        i = 0
                        @ds_indep.each(:row) do |row|
                          empty = []
                          row.each { |k,v| empty.push(k) if v.nil? }
                    Severity: Minor
                    Found in lib/statsample/regression/multiple/rubyengine.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 initialize has 26 lines of code (exceeds 25 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 1 hr to fix

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language