benvial/gyptis

View on GitHub
src/gyptis/utils/sample.py

Summary

Maintainability
C
1 day
Test Coverage

Function _adaptive_sampler has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

def _adaptive_sampler(f, z0, max_bend=10, max_z_rel=1e-3, max_df=0.05):
    z0 = np.sort(z0)
    zmin = min(z0)
    zmax = max(z0)

Severity: Minor
Found in src/gyptis/utils/sample.py - About 1 day 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

Avoid deeply nested control flow statements.
Open

                    if znew not in z:
                        z.append(znew)
                        tnew = f(znew)
                        if multi_output:
                            t.append(tnew[0])
Severity: Major
Found in src/gyptis/utils/sample.py - About 45 mins to fix

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

    def _adaptive_sampler(f, z0, max_bend=10, max_z_rel=1e-3, max_df=0.05):
    Severity: Minor
    Found in src/gyptis/utils/sample.py - About 35 mins to fix

      There are no issues that match your filters.

      Category
      Status