SciRuby/integration

View on GitHub
lib/integration/methods.rb

Summary

Maintainability
D
2 days
Test Coverage

Method gauss_kronrod has 145 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def gauss_kronrod(t1, t2, n, points)
      # g7k15
      case points
        when 15

Severity: Major
Found in lib/integration/methods.rb - About 5 hrs to fix

    File methods.rb has 304 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Integration
      class << self
    
        # Rectangle method
        # +n+ implies number of subdivisions
    Severity: Minor
    Found in lib/integration/methods.rb - About 3 hrs to fix

      Method gauss has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def gauss(t1, t2, n)
            case n
              when 1
                z = [0.0]
                w = [2.0]
      Severity: Minor
      Found in lib/integration/methods.rb - About 1 hr to fix

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

            def adaptive_quadrature(a, b, tolerance)
              h = (b.to_f - a) / 2
              fa = yield(a)
              fc = yield(a + h)
              fb = yield(b)
        Severity: Minor
        Found in lib/integration/methods.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

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

                  z = [-0.9994844100504906, -0.9968934840746495, -0.9916309968704046,
                       -0.9836681232797472, -0.9731163225011262, -0.9600218649683075,
                       -0.94437444474856, -0.9262000474292743, -0.9055733076999078,
                       -0.8825605357920527, -0.8572052335460612, -0.8295657623827684,
                       -0.799727835821839, -0.7677774321048262, -0.7337900624532268,
        Severity: Major
        Found in lib/integration/methods.rb and 1 other location - About 1 hr to fix
        lib/integration/methods.rb on lines 298..320

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

        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

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

                  w = [0.0013890136986770077, 0.003890461127099884,
                       0.0066307039159312926, 0.009273279659517764,
                       0.011823015253496341, 0.014369729507045804, 0.01692088918905327,
                       0.019414141193942382, 0.021828035821609193, 0.0241911620780806,
                       0.0265099548823331, 0.02875404876504129, 0.030907257562387762,
        Severity: Major
        Found in lib/integration/methods.rb and 1 other location - About 1 hr to fix
        lib/integration/methods.rb on lines 276..296

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

        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

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

                  w = [0.0030735837185205317, 0.008600269855642943,
                       0.014626169256971253, 0.020388373461266523, 0.02588213360495116,
                       0.0312873067770328, 0.036600169758200796, 0.041668873327973685,
                       0.04643482186749767, 0.05094457392372869, 0.05519510534828599,
                       0.05911140088063957, 0.06265323755478117, 0.06583459713361842,
        Severity: Minor
        Found in lib/integration/methods.rb and 1 other location - About 50 mins to fix
        lib/integration/methods.rb on lines 242..255

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

        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

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

                  z = [-0.9988590315882777, -0.9931285991850949, -0.9815078774502503,
                       -0.9639719272779138, -0.9408226338317548, -0.912234428251326,
                       -0.878276811252282, -0.8391169718222188, -0.7950414288375512,
                       -0.7463319064601508, -0.6932376563347514, -0.636053680726515,
                       -0.5751404468197103, -0.5108670019508271, -0.4435931752387251,
        Severity: Minor
        Found in lib/integration/methods.rb and 1 other location - About 50 mins to fix
        lib/integration/methods.rb on lines 257..271

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

        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

              (0...n).each do |i|
                t = ((t1.to_f + t2) / 2.0) + (((t2 - t1) / 2.0) * z[i])
                sum += w[i] * yield(t)
              end
        Severity: Minor
        Found in lib/integration/methods.rb and 1 other location - About 30 mins to fix
        lib/integration/methods.rb on lines 341..344

        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

              (0...n).each do |i|
                t = ((t1.to_f + t2) / 2.0) + (((t2 - t1) / 2.0) * z[i])
                sum += w[i] * yield(t)
              end
        Severity: Minor
        Found in lib/integration/methods.rb and 1 other location - About 30 mins to fix
        lib/integration/methods.rb on lines 164..167

        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

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

                  z = [-0.9980022986933971, -0.9879925180204854, -0.9677390756791391,
                       -0.937273392400706, -0.8972645323440819, -0.8482065834104272,
                       -0.790418501442466, -0.7244177313601701, -0.650996741297417,
                       -0.5709721726085388, -0.4850818636402397, -0.3941513470775634,
                       -0.29918000715316884, -0.20119409399743451, -0.1011420669187175,
        Severity: Minor
        Found in lib/integration/methods.rb and 1 other location - About 30 mins to fix
        lib/integration/methods.rb on lines 227..237

        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

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

                  w = [0.005377479872923349, 0.015007947329316122, 0.02546084732671532,
                       0.03534636079137585, 0.04458975132476488, 0.05348152469092809,
                       0.06200956780067064, 0.06985412131872826, 0.07684968075772038,
                       0.08308050282313302, 0.08856444305621176, 0.09312659817082532,
                       0.09664272698362368, 0.09917359872179196, 0.10076984552387559,
        Severity: Minor
        Found in lib/integration/methods.rb and 1 other location - About 30 mins to fix
        lib/integration/methods.rb on lines 215..225

        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

        There are no issues that match your filters.

        Category
        Status