alexandrebarachant/pyRiemann

View on GitHub
pyriemann/utils/median.py

Summary

Maintainability
A
3 hrs
Test Coverage

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

def median_euclid(X, *, tol=10e-6, maxiter=50, init=None, weights=None):
    r"""Euclidean geometric median of matrices.

    The Euclidean geometric median minimizes the sum of Euclidean distances
    :math:`d_E` to all matrices [1]_ [2]_:
Severity: Minor
Found in pyriemann/utils/median.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 median_riemann has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def median_riemann(X, *, tol=10e-6, maxiter=50, init=None, weights=None,
Severity: Major
Found in pyriemann/utils/median.py - About 50 mins to fix

    Function median_euclid has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def median_euclid(X, *, tol=10e-6, maxiter=50, init=None, weights=None):
    Severity: Minor
    Found in pyriemann/utils/median.py - About 45 mins to fix

      Function median_riemann has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def median_riemann(X, *, tol=10e-6, maxiter=50, init=None, weights=None,
                         step_size=1):
          r"""Affine-invariant Riemannian geometric median of SPD/HPD matrices.
      
          The affine-invariant Riemannian geometric median minimizes the sum of
      Severity: Minor
      Found in pyriemann/utils/median.py - 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

      There are no issues that match your filters.

      Category
      Status