SciRuby/distribution

View on GitHub

Showing 74 of 98 total issues

Avoid deeply nested control flow statements.
Open

            scale_factor = scale ? Math.exp(x) : 1.0
Severity: Major
Found in lib/distribution/math_extension/exponential_integral.rb - About 45 mins to fix

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

            def q_asymptotic_uniform(a, x, with_error = false)
              rta = Math.sqrt(a)
              eps = (x - a).quo(a)
    
              ln_term = Log.log_1plusx_minusx(eps, with_error)
    Severity: Minor
    Found in lib/distribution/math_extension/incomplete_gamma.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 create_distribution_methods has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_distribution_methods
          Distribution.libraries_order.each do |l_name|
            if const_defined? l_name
              l = const_get(l_name)
              # Add methods from engine to base base, if not yet included
    Severity: Minor
    Found in lib/distribution/distributable.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 q_series has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def q_series(a, x, with_error = false)
              term1 = nil
              sum   = nil
              term2 = nil
              begin
    Severity: Minor
    Found in lib/distribution/math_extension/incomplete_gamma.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 q_chi2 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def q_chi2(df, chi2)
              chi2 = chi2.to_f
              if (df & 1) != 0
                chi = Math.sqrt(chi2)
    
    
    Severity: Minor
    Found in lib/distribution/chisquare/ruby.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

    Avoid deeply nested control flow statements.
    Open

              elsif x <= 4.0
                s = 1.0 / x * (scale ? 1.0 : Math.exp(-x))
                result_c = ChebyshevSeries.eval((8.0 / x - 5.0) / 3.0, :ae13, with_error)
                result_c, result_c_err = result_c if with_error
                result   = s * (1.0 + result_c)
    Severity: Major
    Found in lib/distribution/math_extension/exponential_integral.rb - About 45 mins to fix

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

            def cdf(aa, bb, sigma, epsilon = 0.0001, alpha = 2.5, max_iterations = 100) # :nodoc:
      Severity: Minor
      Found in lib/distribution/normalmultivariate.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    result_c, result_c_err = result_c if with_error
        Severity: Major
        Found in lib/distribution/math_extension/exponential_integral.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      return x <= 1.0e+06 ? q_continued_fraction(a, x, with_error) : q_large_x(a, x, with_error)
          Severity: Major
          Found in lib/distribution/math_extension/incomplete_gamma.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if x > a - Math.sqrt(a)
                          return q_continued_fraction(a, x, with_error)
                        else
                          p = p_series(a, x, with_error)
                          p, p_err = p if with_error
            Severity: Major
            Found in lib/distribution/math_extension/incomplete_gamma.rb - About 45 mins to fix

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

                      def quantile(p, a, b, rmin = 0, rmax = 1)
              Severity: Minor
              Found in lib/distribution/beta/ruby.rb - About 35 mins to fix

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

                        def cdf_jantaravareerat(x, y, rho, s1 = 1, s2 = 1)
                Severity: Minor
                Found in lib/distribution/bivariatenormal/ruby.rb - About 35 mins to fix

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

                          def continued_fraction(a, b, x, epsabs = nil, with_error = false)
                  Severity: Minor
                  Found in lib/distribution/math_extension/incomplete_beta.rb - About 35 mins to fix

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

                          def initialize(coefficients, expansion_order, lower_interval_point, upper_interval_point, single_precision_order)
                    Severity: Minor
                    Found in lib/distribution/math_extension/chebyshev_series.rb - About 35 mins to fix

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

                              def pdf(x, y, rho, s1 = 1.0, s2 = 1.0)
                      Severity: Minor
                      Found in lib/distribution/bivariatenormal/gsl.rb - About 35 mins to fix

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

                                def pdf(x, y, rho, s1 = 1.0, s2 = 1.0)
                        Severity: Minor
                        Found in lib/distribution/bivariatenormal/ruby.rb - About 35 mins to fix

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

                                  def f(x, y, aprime, bprime, rho)
                          Severity: Minor
                          Found in lib/distribution/bivariatenormal/ruby.rb - About 35 mins to fix

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

                                    def axpy(aa, yy, a, b, x)
                            Severity: Minor
                            Found in lib/distribution/math_extension/incomplete_beta.rb - About 35 mins to fix

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

                                      def pdf_with_den(k, m, n, total, den)
                              Severity: Minor
                              Found in lib/distribution/hypergeometric/ruby.rb - About 35 mins to fix

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

                                        def axpy(aa, yy, a, b, x)
                                          return aa * 0 + yy if x == 0.0
                                          return aa * 1 + yy if x == 1.0
                                
                                          ln_beta   = Math.logbeta(a, b)
                                Severity: Minor
                                Found in lib/distribution/math_extension/incomplete_beta.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