alexandrebarachant/pyRiemann

View on GitHub
pyriemann/spatialfilters.py

Summary

Maintainability
D
2 days
Test Coverage

File spatialfilters.py has 642 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Spatial filtering function."""
import warnings

import numpy as np
from scipy.linalg import eigh, inv
Severity: Major
Found in pyriemann/spatialfilters.py - About 1 day to fix

    Function fit has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def fit(self, X, y):
            """Train CSP spatial filters.
    
            Parameters
            ----------
    Severity: Minor
    Found in pyriemann/spatialfilters.py - 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

    Function fit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def fit(self, X, y=None):
            """Fit.
    
            Compute and diagonalize cospectra, to estimate forward and backward
            spatial filters.
    Severity: Minor
    Found in pyriemann/spatialfilters.py - 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

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

        def __init__(self, window=128, overlap=0.5, fmin=None, fmax=None, fs=None,
    Severity: Major
    Found in pyriemann/spatialfilters.py - About 50 mins to fix

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

          def inverse_transform(self, X, supp=None):
              """Transform source space to channel space.
      
              Transform source space to channel space, applying backward spatial
              filters, with the possibility to suppress some sources, like in BSS
      Severity: Minor
      Found in pyriemann/spatialfilters.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

      Function transform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def transform(self, X):
              """Apply spatial filters.
      
              Parameters
              ----------
      Severity: Minor
      Found in pyriemann/spatialfilters.py - About 25 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