alexandrebarachant/pyRiemann

View on GitHub

Showing 185 of 185 total issues

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

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

ax3.scatter(C_rp[0, 0], C_rp[0, 1], C_rp[1, 1], c="chartreuse", marker="*",
Severity: Major
Found in examples/simulated/plot_mean_median_comparison.py and 1 other location - About 2 hrs to fix
examples/simulated/plot_mean_median_comparison.py on lines 127..127

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 51.

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 __init__ has 15 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

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

    ax2.scatter(C_emean[0, 0], C_emean[0, 1], C_emean[1, 1], c="r", marker="x",
    Severity: Major
    Found in examples/simulated/plot_mean_median_comparison.py and 7 other locations - About 1 hr to fix
    examples/simulated/plot_mean_median_comparison.py on lines 102..102
    examples/simulated/plot_mean_median_comparison.py on lines 104..104
    examples/simulated/plot_mean_median_comparison.py on lines 106..106
    examples/simulated/plot_mean_median_comparison.py on lines 129..129
    examples/simulated/plot_mean_median_comparison.py on lines 131..131
    examples/simulated/plot_mean_median_comparison.py on lines 133..133
    examples/simulated/plot_mean_median_comparison.py on lines 135..135

    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 48.

    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 8 locations. Consider refactoring.
    Open

    ax2.scatter(C_rmed[0, 0], C_rmed[0, 1], C_rmed[1, 1], c="m", marker="s",
    Severity: Major
    Found in examples/simulated/plot_mean_median_comparison.py and 7 other locations - About 1 hr to fix
    examples/simulated/plot_mean_median_comparison.py on lines 100..100
    examples/simulated/plot_mean_median_comparison.py on lines 102..102
    examples/simulated/plot_mean_median_comparison.py on lines 104..104
    examples/simulated/plot_mean_median_comparison.py on lines 129..129
    examples/simulated/plot_mean_median_comparison.py on lines 131..131
    examples/simulated/plot_mean_median_comparison.py on lines 133..133
    examples/simulated/plot_mean_median_comparison.py on lines 135..135

    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 48.

    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 8 locations. Consider refactoring.
    Open

    ax3.scatter(C_rmed[0, 0], C_rmed[0, 1], C_rmed[1, 1], c="m", marker="s",
    Severity: Major
    Found in examples/simulated/plot_mean_median_comparison.py and 7 other locations - About 1 hr to fix
    examples/simulated/plot_mean_median_comparison.py on lines 100..100
    examples/simulated/plot_mean_median_comparison.py on lines 102..102
    examples/simulated/plot_mean_median_comparison.py on lines 104..104
    examples/simulated/plot_mean_median_comparison.py on lines 106..106
    examples/simulated/plot_mean_median_comparison.py on lines 129..129
    examples/simulated/plot_mean_median_comparison.py on lines 131..131
    examples/simulated/plot_mean_median_comparison.py on lines 133..133

    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 48.

    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 8 locations. Consider refactoring.
    Open

    ax2.scatter(C_rmean[0, 0], C_rmean[0, 1], C_rmean[1, 1], c="m", marker="x",
    Severity: Major
    Found in examples/simulated/plot_mean_median_comparison.py and 7 other locations - About 1 hr to fix
    examples/simulated/plot_mean_median_comparison.py on lines 100..100
    examples/simulated/plot_mean_median_comparison.py on lines 104..104
    examples/simulated/plot_mean_median_comparison.py on lines 106..106
    examples/simulated/plot_mean_median_comparison.py on lines 129..129
    examples/simulated/plot_mean_median_comparison.py on lines 131..131
    examples/simulated/plot_mean_median_comparison.py on lines 133..133
    examples/simulated/plot_mean_median_comparison.py on lines 135..135

    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 48.

    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 8 locations. Consider refactoring.
    Open

    ax2.scatter(C_emed[0, 0], C_emed[0, 1], C_emed[1, 1], c="r", marker="s",
    Severity: Major
    Found in examples/simulated/plot_mean_median_comparison.py and 7 other locations - About 1 hr to fix
    examples/simulated/plot_mean_median_comparison.py on lines 100..100
    examples/simulated/plot_mean_median_comparison.py on lines 102..102
    examples/simulated/plot_mean_median_comparison.py on lines 106..106
    examples/simulated/plot_mean_median_comparison.py on lines 129..129
    examples/simulated/plot_mean_median_comparison.py on lines 131..131
    examples/simulated/plot_mean_median_comparison.py on lines 133..133
    examples/simulated/plot_mean_median_comparison.py on lines 135..135

    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 48.

    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 8 locations. Consider refactoring.
    Open

    ax3.scatter(C_rmean[0, 0], C_rmean[0, 1], C_rmean[1, 1], c="m", marker="x",
    Severity: Major
    Found in examples/simulated/plot_mean_median_comparison.py and 7 other locations - About 1 hr to fix
    examples/simulated/plot_mean_median_comparison.py on lines 100..100
    examples/simulated/plot_mean_median_comparison.py on lines 102..102
    examples/simulated/plot_mean_median_comparison.py on lines 104..104
    examples/simulated/plot_mean_median_comparison.py on lines 106..106
    examples/simulated/plot_mean_median_comparison.py on lines 129..129
    examples/simulated/plot_mean_median_comparison.py on lines 133..133
    examples/simulated/plot_mean_median_comparison.py on lines 135..135

    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 48.

    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 8 locations. Consider refactoring.
    Open

    ax3.scatter(C_emed[0, 0], C_emed[0, 1], C_emed[1, 1], c="r", marker="s",
    Severity: Major
    Found in examples/simulated/plot_mean_median_comparison.py and 7 other locations - About 1 hr to fix
    examples/simulated/plot_mean_median_comparison.py on lines 100..100
    examples/simulated/plot_mean_median_comparison.py on lines 102..102
    examples/simulated/plot_mean_median_comparison.py on lines 104..104
    examples/simulated/plot_mean_median_comparison.py on lines 106..106
    examples/simulated/plot_mean_median_comparison.py on lines 129..129
    examples/simulated/plot_mean_median_comparison.py on lines 131..131
    examples/simulated/plot_mean_median_comparison.py on lines 135..135

    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 48.

    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 8 locations. Consider refactoring.
    Open

    ax3.scatter(C_emean[0, 0], C_emean[0, 1], C_emean[1, 1], c="r", marker="x",
    Severity: Major
    Found in examples/simulated/plot_mean_median_comparison.py and 7 other locations - About 1 hr to fix
    examples/simulated/plot_mean_median_comparison.py on lines 100..100
    examples/simulated/plot_mean_median_comparison.py on lines 102..102
    examples/simulated/plot_mean_median_comparison.py on lines 104..104
    examples/simulated/plot_mean_median_comparison.py on lines 106..106
    examples/simulated/plot_mean_median_comparison.py on lines 131..131
    examples/simulated/plot_mean_median_comparison.py on lines 133..133
    examples/simulated/plot_mean_median_comparison.py on lines 135..135

    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 48.

    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 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 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 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

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

          p_ep.set_offsets(np.c_[covs_visu[:, 0, 0], covs_visu[:, 1, 1]])
      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 242..242

      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 44.

      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

          p_rp.set_offsets(np.c_[covs_visu[:, 0, 0], covs_visu[:, 1, 1]])
      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 244..244

      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 44.

      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 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 __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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