SciRuby/integration

View on GitHub

Showing 22 of 22 total issues

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 integrate_ruby has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def integrate_ruby(lower_bound, upper_bound, options, &f)
            method = options[:method]
            tolerance = options[:tolerance]
            initial_step = options[:initial_step]
            step = options[:step]
      Severity: Minor
      Found in lib/integration.rb - About 2 hrs 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 integrate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def integrate(t1, t2, options = {}, &f)
            inf_bounds = (infinite?(t1) || infinite?(t2))
      
            fail 'No function passed' unless block_given?
            fail 'Non-numeric bounds' unless ((t1.is_a? Numeric) && (t2.is_a? Numeric)) || inf_bounds
      Severity: Minor
      Found in lib/integration.rb - About 2 hrs 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 3 locations. Consider refactoring.
      Open

          def minimize
            # create Buffers for inputs and outputs
            start_buffer    = FFI::Buffer.alloc_inout(:pointer, @n)
            expected_buffer = FFI::Buffer.alloc_inout(:pointer, @n)
            end_buffer      = FFI::Buffer.alloc_inout(:pointer, @n)
      Severity: Major
      Found in lib/opencl/opencl_minimization.rb and 2 other locations - About 1 hr to fix
      lib/opencl/opencl_minimization.rb on lines 160..181
      lib/opencl/opencl_minimization.rb on lines 226..247

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

      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 3 locations. Consider refactoring.
      Open

          def minimize
            # create Buffers for inputs and outputs
            start_buffer    = FFI::Buffer.alloc_inout(:pointer, @n)
            expected_buffer = FFI::Buffer.alloc_inout(:pointer, @n)
            end_buffer      = FFI::Buffer.alloc_inout(:pointer, @n)
      Severity: Major
      Found in lib/opencl/opencl_minimization.rb and 2 other locations - About 1 hr to fix
      lib/opencl/opencl_minimization.rb on lines 58..79
      lib/opencl/opencl_minimization.rb on lines 226..247

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

      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 3 locations. Consider refactoring.
      Open

          def minimize
            # create Buffers for inputs and outputs
            start_buffer    = FFI::Buffer.alloc_inout(:pointer, @n)
            expected_buffer = FFI::Buffer.alloc_inout(:pointer, @n)
            end_buffer      = FFI::Buffer.alloc_inout(:pointer, @n)
      Severity: Major
      Found in lib/opencl/opencl_minimization.rb and 2 other locations - About 1 hr to fix
      lib/opencl/opencl_minimization.rb on lines 58..79
      lib/opencl/opencl_minimization.rb on lines 160..181

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

      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

      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

        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

        Method integrate_ruby has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def integrate_ruby(lower_bound, upper_bound, options, &f)
              method = options[:method]
              tolerance = options[:tolerance]
              initial_step = options[:initial_step]
              step = options[:step]
        Severity: Minor
        Found in lib/integration.rb - About 1 hr to fix

          Method integrate_gsl has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def integrate_gsl(lower_bound, upper_bound, options, &f)
                f = GSL::Function.alloc(&f)
                method = options[:method]
                tolerance = options[:tolerance]
          
          
          Severity: Minor
          Found in lib/integration.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

          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

          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

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

              def initialize(n, start_point, expected_point, end_point, f)
          Severity: Minor
          Found in lib/opencl/opencl_minimization.rb - About 35 mins to fix

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

                def initialize(n, start_point, expected_point, end_point, f)
            Severity: Minor
            Found in lib/opencl/opencl_minimization.rb - About 35 mins to fix

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

                  def initialize(n, expected_point, f, fd, fdd)
              Severity: Minor
              Found in lib/opencl/opencl_minimization.rb - About 35 mins 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

                          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

                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

                Severity
                Category
                Status
                Source
                Language