SciRuby/distribution

View on GitHub

Showing 98 of 98 total issues

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 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 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 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 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

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                          result = x * x * (C1 + x * (C2 + x * (C3 + x * (C4 + x * begin
                            C5 + x * (C6 + x * (C7 + x * (C8 + x * C9))) # formerly t = this
              Severity: Minor
              Found in lib/distribution/math_extension/log_utilities.rb and 1 other location - About 35 mins to fix
              lib/distribution/math_extension/log_utilities.rb on lines 33..34

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 34.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                          result = x * (1.0 + x * (C1 + x * (C2 + x * (C3 + x * (C4 + x * begin
                            C5 + x * (C6 + x * (C7 + x * (C8 + x * C9))) # formerly t = this
              Severity: Minor
              Found in lib/distribution/math_extension/log_utilities.rb and 1 other location - About 35 mins to fix
              lib/distribution/math_extension/log_utilities.rb on lines 52..53

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 34.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                          p = p_series(a, x, with_error)
                          p, p_err = p if with_error
                          result  = 1.0 - p
                          return with_error ? [result, p_err + 2.0 * Float::EPSILON * result.abs] : result
                        elsif a >= 1.0e+06 && (x - a) * (x - a) < a # difficult asymptotic regime, only way to do this region
              Severity: Minor
              Found in lib/distribution/math_extension/incomplete_gamma.rb and 1 other location - About 30 mins to fix
              lib/distribution/math_extension/incomplete_gamma.rb on lines 153..157

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 33.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                            p = p_series(a, x, with_error)
                            p, p_err = p if with_error
                            result = 1.0 - p
                            return with_error ? [result, p_err + 2.0 * Float::EPSILON * result.abs] : result
                          end
              Severity: Minor
              Found in lib/distribution/math_extension/incomplete_gamma.rb and 1 other location - About 30 mins to fix
              lib/distribution/math_extension/incomplete_gamma.rb on lines 139..143

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 33.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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
                                Severity
                                Category
                                Status
                                Source
                                Language