sonntagsgesicht/mathtoolspy

View on GitHub

Showing 64 of 64 total issues

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

            b[0][0] = 2.0 * ((y[1] - y[0]) / (x[1] - x[0]) ** 3
                             - (y[2] - y[1]) / (x[2] - x[1]) ** 3)
Severity: Major
Found in mathtoolspy/interpolation/spline.py and 1 other location - About 1 hr to fix
mathtoolspy/interpolation/spline.py on lines 160..160

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

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

Function integrate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def integrate(self, function, lower_bound, upper_bound):
        if upper_bound - lower_bound > GaussKronrodIntegrator._MAX_INTEGRAL_LENGTH:
            bounds = self._get_bounds(lower_bound, upper_bound)
            return sum([self.integrate(function, a, b) for a, b in bounds])

Severity: Minor
Found in mathtoolspy/integration/gauss_kronrod_integrator.py - About 1 hr 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

if os.path.exists(rst_prolog_file):
    f = open(rst_prolog_file, 'r')
    rst_prolog += os.linesep + f.read()
    f.close()
Severity: Major
Found in doc/sphinx/conf.py and 1 other location - About 1 hr to fix
doc/sphinx/conf.py on lines 125..128

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

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

if os.path.exists(rst_epilog_file):
    f = open(rst_epilog_file, 'r')
    rst_epilog += os.linesep + f.read()
    f.close()
Severity: Major
Found in doc/sphinx/conf.py and 1 other location - About 1 hr to fix
doc/sphinx/conf.py on lines 119..122

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

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

Function mn_brak_ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def mn_brak_(a, b, fct):
    ax = a
    bx = b
    ulim = u = r = q = fu = dum = 0.0
    fa = fct(a)
Severity: Minor
Found in mathtoolspy/solver/minimum_bracketing.py - About 1 hr 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

Function mn_brak has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def mn_brak(a, b, fct):
    ax = a
    bx = b
    ulim = u = r = q = fu = 0.0
    fa = fct(a)
Severity: Minor
Found in mathtoolspy/solver/minimum_bracketing.py - About 1 hr 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

            mat[0][2] = -1.0 / (x[2] - x[1]) ** 2
Severity: Major
Found in mathtoolspy/interpolation/spline.py and 1 other location - About 1 hr to fix
mathtoolspy/interpolation/spline.py on lines 156..156

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

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

            mat[0][0] = 1.0 / (x[1] - x[0]) ** 2
Severity: Major
Found in mathtoolspy/interpolation/spline.py and 1 other location - About 1 hr to fix
mathtoolspy/interpolation/spline.py on lines 157..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 47.

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

Function integrate has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def integrate(self, function, lower_bound, upper_bound):
        if lower_bound == upper_bound:
            return 0
        if lower_bound > upper_bound:
            return -self.integrate(function, upper_bound, lower_bound)
Severity: Minor
Found in mathtoolspy/integration/gauss_lobatto_integrator.py - About 1 hr to fix

    Function _set_interpolation_coefficients has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def _set_interpolation_coefficients(self):
            """
            computes the coefficients for the single polynomials of the spline.
            """
    
    
    Severity: Minor
    Found in mathtoolspy/interpolation/spline.py - About 1 hr 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

    Function interpolation_bilinear has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def interpolation_bilinear(x, y, x1, x2, y1, y2, z11, z21, z22, z12):
    Severity: Major
    Found in mathtoolspy/interpolation/bilinear.py - About 1 hr to fix

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

                  mat[0][1] = 1.0 / (x[1] - x[0])
      Severity: Major
      Found in mathtoolspy/interpolation/spline.py and 1 other location - About 1 hr to fix
      mathtoolspy/interpolation/spline.py on lines 170..170

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

      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

              i2 = (h / 6.0) * (fa + fb + 5.0 * (fml + fmr))
      Severity: Major
      Found in mathtoolspy/integration/gauss_lobatto_integrator.py and 1 other location - About 1 hr to fix
      mathtoolspy/integration/gauss_lobatto_integrator.py on lines 101..101

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

      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

              i2 = (h / 6.0) * (fa + fb + 5.0 * (f5 + f9))
      Severity: Major
      Found in mathtoolspy/integration/gauss_lobatto_integrator.py and 1 other location - About 1 hr to fix
      mathtoolspy/integration/gauss_lobatto_integrator.py on lines 36..36

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

      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

                  mat[0][0] = 2.0 / (x[1] - x[0])
      Severity: Major
      Found in mathtoolspy/interpolation/spline.py and 1 other location - About 1 hr to fix
      mathtoolspy/interpolation/spline.py on lines 171..171

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

      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

      Function minimize_algorithm_1dim_golden has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def minimize_algorithm_1dim_golden(function, a, b, c, tolerance=DOUBLE_TOL):
          '''
          Given a function f, and given a bracketing triplet of abscissas ax, bx, cx
          (such that bx is between ax and cx, and f(bx) is less than both f(ax) and f(cx)),
          this routine performs a golden section search for the minimum, isolating it to
      Severity: Minor
      Found in mathtoolspy/solver/minimize_algorithm_1dim_golden.py - About 1 hr 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

      Function invert_matrix has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def invert_matrix(A, tol=None):
          """
          Returns the inverse of the passed in matrix.
              :param A: The matrix to be inversed
      
      
      Severity: Minor
      Found in mathtoolspy/matrix/misc.py - About 1 hr 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

      Function get_value has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_value(self, x, y):
              ix = bisect.bisect_left(self.xaxis, x)  # x <= self.xaxis[ix]
              iy = bisect.bisect_left(self.yaxis, y)
      
              if ix > 0 and ix < self.nx and iy > 0 and iy < self.ny:
      Severity: Minor
      Found in mathtoolspy/utils/surface.py - About 1 hr 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

      Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, max_number_of_iterations=255, initial_order=3, min_number_of_iterations=7,
      Severity: Major
      Found in mathtoolspy/integration/gauss_kronrod_integrator.py - About 50 mins to fix

        Function _checkDimension has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _checkDimension(self, constraint, initialValues):
                c = len(constraint) if constraint     else -1
                n = len(initialValues) if initialValues  else -1
                if n > -1 and c > -1:
                    if n != c:
        Severity: Minor
        Found in mathtoolspy/solver/optimizer.py - 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

        Severity
        Category
        Status
        Source
        Language