alexandrebarachant/pyRiemann

View on GitHub

Showing 137 of 184 total issues

Function pairwise_distance has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def pairwise_distance(X, Y=None, metric="riemann", squared=False):
    """Pairwise distance matrix.

    Compute the matrix of distances between pairs of elements of X and Y.

Severity: Minor
Found in pyriemann/utils/distance.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 is_hankel has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def is_hankel(X):
    """Check if matrix is an Hankel matrix.

    Parameters
    ----------
Severity: Minor
Found in pyriemann/utils/test.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 test has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def test(self, X, y, groups=None, verbose=True):
        """Performs the permutation test

        Parameters
        ----------
Severity: Minor
Found in pyriemann/stats.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 _prepare_dimension_reduction has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def _prepare_dimension_reduction(self, X, Xm):
        """Prepare dimension reduction."""
        if len(self.dim_red) > 1:
            raise ValueError(
                'Dictionary dim_red must contain only one element (Got %d)'
Severity: Minor
Found in pyriemann/preprocessing.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 _slice_one_sample has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def _slice_one_sample(ptarget, x0, w, rs):
    """Slice sampling for one sample

    Parameters
    ----------
Severity: Minor
Found in pyriemann/datasets/sampling.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 15 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in pyriemann/classification.py - About 1 hr to fix

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

    def mean_power(X=None, p=None, *, sample_weight=None, zeta=10e-10, maxiter=100,
                   covmats=None):
        r"""Power mean of SPD/HPD matrices.
    
        Power mean of order p is the solution of [1]_ [2]_:
    Severity: Minor
    Found in pyriemann/utils/mean.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 rjd has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def rjd(X, *, init=None, eps=1e-8, n_iter_max=100):
        """Approximate joint diagonalization based on JADE.
    
        This is an implementation of the orthogonal AJD algorithm [1]_: joint
        approximate diagonalization of eigen-matrices (JADE), based on Jacobi
    Severity: Minor
    Found in pyriemann/utils/ajd.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 coherence has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def coherence(X, window=128, overlap=0.75, fmin=None, fmax=None, fs=None,
                  coh='ordinary'):
        """Compute squared coherence.
    
        Parameters
    Severity: Minor
    Found in pyriemann/utils/covariance.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 freq_selection_class_dis has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def freq_selection_class_dis(raw, freq_band=(5., 35.), sub_band_width=4,
    Severity: Major
    Found in examples/motor-imagery/helpers/frequencybandselection_helpers.py - About 1 hr to fix

      Function maskedmean_riemann has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def maskedmean_riemann(X=None, masks=None, tol=10e-9, maxiter=100, init=None,
                             sample_weight=None, covmats=None):
          """Masked Riemannian mean of SPD/HPD matrices.
      
          Given masks defined as semi-orthogonal matrices, the masked Riemannian mean
      Severity: Minor
      Found in pyriemann/utils/mean.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 make_gaussian_blobs has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def make_gaussian_blobs(n_matrices=100, n_dim=2, class_sep=1.0, class_disp=1.0,
      Severity: Major
      Found in pyriemann/datasets/simulated.py - About 1 hr to fix

        Function plot_waveforms has 11 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def plot_waveforms(X, display, *, times=None, color="gray", alpha=0.5,
        Severity: Major
        Found in pyriemann/utils/viz.py - About 1 hr to fix

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

              def __init__(
          Severity: Major
          Found in pyriemann/regression.py - About 1 hr to fix

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

                def fit(self, X, y_enc):
                    """Fit TLEstimator.
            
                    Parameters
                    ----------
            Severity: Minor
            Found in pyriemann/transfer/_estimators.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 fit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def fit(self, X, y=None, sample_weight=None):
                    """Find the optimal subset of electrodes.
            
                    Parameters
                    ----------
            Severity: Minor
            Found in pyriemann/channelselection.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 covariance_mest has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def covariance_mest(X, m_estimator, *, init=None, tol=10e-3, n_iter_max=50,
            Severity: Major
            Found in pyriemann/utils/covariance.py - About 1 hr to fix

              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 ajd_pham has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              def ajd_pham(X, *, init=None, eps=1e-6, n_iter_max=20, sample_weight=None):
                  """Approximate joint diagonalization based on Pham's algorithm.
              
                  This is a direct implementation of the AJD algorithm [1]_, optimizing a
                  log-likelihood criterion based on the Kullback-Leibler divergence.
              Severity: Minor
              Found in pyriemann/utils/ajd.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

              Severity
              Category
              Status
              Source
              Language