alexandrebarachant/pyRiemann

View on GitHub

Showing 184 of 184 total issues

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

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

      def _rejection_sampling_2D(n_samples, sigma, random_state=None,
                                 return_acceptance_rate=False):
          """Rejection sampling algorithm for the 2D case.
      
          Implementation of a rejection sampling algorithm. The implementation
      Severity: Minor
      Found in pyriemann/datasets/sampling.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              if rp_label == 1:
                  rpotato.partial_fit(covs[np.newaxis, t], alpha=1 / t)
      Severity: Major
      Found in examples/artifacts/plot_detect_riemannian_potato_EEG.py and 1 other location - About 1 hr to fix
      examples/artifacts/plot_detect_riemannian_potato_EEG.py on lines 216..217

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 40.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              if ep_label == 1:
                  epotato.partial_fit(covs[np.newaxis, t], alpha=1 / t)
      Severity: Major
      Found in examples/artifacts/plot_detect_riemannian_potato_EEG.py and 1 other location - About 1 hr to fix
      examples/artifacts/plot_detect_riemannian_potato_EEG.py on lines 214..215

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 40.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function _fit_single has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _fit_single(X, y=None, n_clusters=2, init="random", random_state=None,
      Severity: Major
      Found in pyriemann/clustering.py - About 1 hr to fix

        Function plot_potato_2D has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def plot_potato_2D(ax, cax, X, Y, p_zscores, p_center, covs, p_colors, clabel):
        Severity: Major
        Found in examples/artifacts/plot_detect_riemannian_potato_EEG.py - About 1 hr to fix

          Function get_results has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_results(X, y, all_ppl):
              results = []
              le = LabelEncoder()
              y_ = le.fit_transform(y)
              cv = StratifiedKFold(5, shuffle=True, random_state=42)
          Severity: Minor
          Found in examples/motor-imagery/helpers/coherence_helpers.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_classification_transfer has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

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

            Function _run_minimization has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def _run_minimization(Q_ini, M_source, M_target, weights=None, metric='euclid',
            Severity: Major
            Found in pyriemann/transfer/_rotate.py - About 1 hr to fix

              Function _get_filtered_cov has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def _get_filtered_cov(raw, picks, event_id, fmin, fmax, tmin, tmax, verbose):
              Severity: Major
              Found in examples/motor-imagery/helpers/frequencybandselection_helpers.py - About 1 hr to fix

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

                    def __init__(self, n_clusters=2, max_iter=100, metric="riemann",
                Severity: Major
                Found in pyriemann/clustering.py - About 1 hr to fix

                  Function make_matrices has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def make_matrices(n_matrices, n_dim, kind, rs=None, return_params=False,
                  Severity: Major
                  Found in pyriemann/datasets/simulated.py - About 1 hr to fix

                    Function mean_riemann has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def mean_riemann(X=None, tol=10e-9, maxiter=50, init=None, sample_weight=None,
                                     covmats=None):
                        r"""Mean of SPD/HPD matrices according to the Riemannian metric.
                    
                        The affine-invariant Riemannian mean minimizes the sum of squared
                    Severity: Minor
                    Found in pyriemann/utils/mean.py - About 55 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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                within += distance(
                                    X[y == classe],
                                    covmeans[ix],
                                    metric=mdm.metric_dist,
                    Severity: Minor
                    Found in pyriemann/stats.py and 1 other location - About 55 mins to fix
                    pyriemann/stats.py on lines 403..406

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 37.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Function mean_alm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def mean_alm(X=None, tol=1e-14, maxiter=100, sample_weight=None, covmats=None):
                        r"""Ando-Li-Mathias (ALM) mean of SPD/HPD matrices.
                    
                        Return the geometric mean recursively [1]_, generalizing from:
                    
                    
                    Severity: Minor
                    Found in pyriemann/utils/mean.py - About 55 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

                    Severity
                    Category
                    Status
                    Source
                    Language