sonntagsgesicht/mathtoolspy

View on GitHub
mathtoolspy/solver/minimize_algorithm_1dim_brent.py

Summary

Maintainability
C
1 day
Test Coverage

Function minimize_algorithm_1dim_brent has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

def minimize_algorithm_1dim_brent(fct, _a, _b, _c, tolerance=DOUBLE_TOL):
    '''
    Finds the minimum of the given function f. The arguments are the given function f, and given a bracketing triplet of abscissas A, B, C
    (such that B is between A and C, and f(B) is less than both f(A) and f(C)) and the Tolerance.
    This routine isolates the minimum to a fractional precision of about tol using
Severity: Minor
Found in mathtoolspy/solver/minimize_algorithm_1dim_brent.py - About 7 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

Function minimize_algorithm_1dim_brent has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def minimize_algorithm_1dim_brent(fct, _a, _b, _c, tolerance=DOUBLE_TOL):
Severity: Minor
Found in mathtoolspy/solver/minimize_algorithm_1dim_brent.py - About 35 mins to fix

    There are no issues that match your filters.

    Category
    Status