SciRuby/distribution

View on GitHub

Showing 74 of 98 total issues

Avoid too many return statements within this method.
Open

              return q_large_x_complement(a, x, with_error)
Severity: Major
Found in lib/distribution/math_extension/incomplete_gamma.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return series(a.to_f, x.to_f, with_error)
    Severity: Major
    Found in lib/distribution/math_extension/incomplete_gamma.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return cdf(a, 0.0, rho1) + cdf(b, 0.0, rho2) - delta
      Severity: Major
      Found in lib/distribution/bivariatenormal/ruby.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                      return with_error ? [result, p_err + 2.0 * Float::EPSILON * result.abs] : result
        Severity: Major
        Found in lib/distribution/math_extension/incomplete_gamma.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return value.nan? ? Float::NAN : value
          Severity: Major
          Found in lib/distribution/f/ruby.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return q_asymptotic_uniform_complement a, x, with_error
            Severity: Major
            Found in lib/distribution/math_extension/incomplete_gamma.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              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 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return p_series(a, x, with_error)
                Severity: Major
                Found in lib/distribution/math_extension/incomplete_gamma.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return q_series(a, x, with_error)
                  Severity: Major
                  Found in lib/distribution/math_extension/incomplete_gamma.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                  return q_continued_fraction(a, x, with_error)
                    Severity: Major
                    Found in lib/distribution/math_extension/incomplete_gamma.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return with_error ? [result, 2.0 * (1.0 + a.abs) * Float::EPSILON * gax.abs] : result
                      Severity: Major
                      Found in lib/distribution/math_extension/incomplete_gamma.rb - About 30 mins to fix

                        Method pdf has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def pdf(x, a, b)
                                  return 0 if x < 0
                                  if x == 0
                                    return 1.quo(b) if a == 1
                                    return 0
                        Severity: Minor
                        Found in lib/distribution/gamma/ruby.rb - About 25 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_has_library has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def create_has_library(library) #:nodoc:
                              define_singleton_method("has_#{library}?") do
                                cv = "@@#{library}"
                                unless class_variable_defined? cv
                                  begin
                        Severity: Minor
                        Found in lib/distribution.rb - About 25 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_t has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def p_t(df, t)
                                  if df.to_i != df
                                    x = (t + Math.sqrt(t**2 + df)) / (2 * Math.sqrt(t**2 + df))
                                    return Math.regularized_beta(x, df / 2.0, df / 2.0)
                                  end
                        Severity: Minor
                        Found in lib/distribution/t/ruby.rb - About 25 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