wafo-project/pywafo

View on GitHub
src/wafo/kdetools/gridding.py

Summary

Maintainability
F
4 days
Test Coverage

Function accum has a Cognitive Complexity of 16 (exceeds 15 allowed). Consider refactoring.
Open

def accum(accmap, a, func=None, shape=None, fill_value=0, dtype=None):
    """An accumulation function similar to Matlab's `accumarray` function.

    Parameters
    ----------
Severity: Minor
Found in src/wafo/kdetools/gridding.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

Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.
Open

def accum(accmap, a, func=None, shape=None, fill_value=0, dtype=None):
Severity: Critical
Found in src/wafo/kdetools/gridding.py by sonar-python

Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

See

Remove this commented out code.
Open

    #  acfun = accumsum_sparse  # faster than accum
Severity: Major
Found in src/wafo/kdetools/gridding.py by sonar-python

Programmers should not comment out code as it bloats programs and reduces readability.

Unused code should be deleted and can be retrieved from source control history if required.

See

  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

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

    if shape is None:
        shape = 1 + np.squeeze(np.apply_over_axes(np.max, accmap,
                                                  axes=tuple(range(a.ndim))))
Severity: Major
Found in src/wafo/kdetools/gridding.py and 1 other location - About 3 hrs to fix
src/wafo/kdetools/gridding.py on lines 55..57

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

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

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

    if shape is None:
        shape = 1 + np.squeeze(np.apply_over_axes(np.max, accmap,
                                                  axes=tuple(range(a.ndim))))
Severity: Major
Found in src/wafo/kdetools/gridding.py and 1 other location - About 3 hrs to fix
src/wafo/kdetools/gridding.py on lines 97..99

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

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

    datlo, datup = dataset.min(axis=1), dataset.max(axis=1)
Severity: Major
Found in src/wafo/kdetools/gridding.py and 1 other location - About 1 hr to fix
src/wafo/kdetools/kernels.py on lines 1188..1188

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

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

def _assert(cond, msg):
    if not cond:
        raise ValueError(msg)
Severity: Major
Found in src/wafo/kdetools/gridding.py and 11 other locations - About 1 hr to fix
src/wafo/integrate.py on lines 24..26
src/wafo/integrate_oscillating.py on lines 25..27
src/wafo/interpolate.py on lines 17..19
src/wafo/kdetools/kdetools.py on lines 36..38
src/wafo/kdetools/kernels.py on lines 22..24
src/wafo/sg_filter/_core.py on lines 20..22
src/wafo/stats/estimation.py on lines 51..53
src/wafo/stats/estimation.py on lines 56..58
src/wafo/stats/estimation.py on lines 61..63
src/wafo/transform/models.py on lines 38..40
src/wafo/wave_theory/dispersion_relation.py on lines 17..19

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

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

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

        for s in product(*[list(range(k)) for k in shape]):
Severity: Major
Found in src/wafo/kdetools/gridding.py and 1 other location - About 1 hr to fix
src/wafo/kdetools/gridding.py on lines 221..221

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

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

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

    for s in product(*[list(range(k)) for k in shape]):
Severity: Major
Found in src/wafo/kdetools/gridding.py and 1 other location - About 1 hr to fix
src/wafo/kdetools/gridding.py on lines 186..186

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

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

        if vals[s] == []:
            out[s] = fill_value
        else:
            out[s] = func(vals[s])
Severity: Major
Found in src/wafo/kdetools/gridding.py and 2 other locations - About 1 hr to fix
src/wafo/stats/_continuous_distns.py on lines 6359..6359
src/wafo/stats/_continuous_distns.py on lines 6381..6381

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

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

Identical blocks of code found in 15 locations. Consider refactoring.
Open

if __name__ == '__main__':
    from wafo.testing import test_docstrings
    test_docstrings(__file__)
Severity: Major
Found in src/wafo/kdetools/gridding.py and 14 other locations - About 1 hr to fix
src/wafo/bitwise.py on lines 85..87
src/wafo/containers.py on lines 639..641
src/wafo/dctpack.py on lines 435..437
src/wafo/demos.py on lines 144..146
src/wafo/gaussian.py on lines 1033..1035
src/wafo/integrate.py on lines 1470..1472
src/wafo/kdetools/demo.py on lines 328..330
src/wafo/markov.py on lines 1439..1441
src/wafo/misc.py on lines 2928..2930
src/wafo/padua.py on lines 529..531
src/wafo/sg_filter/_core.py on lines 1221..1223
src/wafo/sg_filter/demos.py on lines 473..475
src/wafo/transform/core.py on lines 214..216
src/wafo/wave_theory/dispersion_relation.py on lines 206..208

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

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

    c = (acfun(binx, (x[binx + 1] - data) * y, shape=(inc, )) +
Severity: Major
Found in src/wafo/kdetools/gridding.py and 1 other location - About 1 hr to fix
src/wafo/covariance/core.py on lines 512..512

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

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

            two = np.mod(ix + 1, 2)
Severity: Major
Found in src/wafo/kdetools/gridding.py and 5 other locations - About 1 hr to fix
src/wafo/integrate.py on lines 252..252
src/wafo/integrate.py on lines 345..345
src/wafo/integrate.py on lines 511..511
src/wafo/integrate.py on lines 614..614
src/wafo/misc.py on lines 1579..1579

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

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

    if dtype is None:
        dtype = a.dtype
Severity: Major
Found in src/wafo/kdetools/gridding.py and 8 other locations - About 1 hr to fix
src/wafo/kdetools/gridding.py on lines 203..204
src/wafo/kdetools/gridding.py on lines 205..206
src/wafo/kdetools/kdetools.py on lines 1003..1004
src/wafo/spectrum/core.py on lines 3094..3095
src/wafo/spectrum/models.py on lines 804..805
src/wafo/spectrum/models.py on lines 806..807
src/wafo/transform/estimation.py on lines 232..233
src/wafo/transform/estimation.py on lines 234..235

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

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

        if func is None:
            func = np.sum
Severity: Major
Found in src/wafo/kdetools/gridding.py and 8 other locations - About 1 hr to fix
src/wafo/kdetools/gridding.py on lines 53..54
src/wafo/kdetools/gridding.py on lines 205..206
src/wafo/kdetools/kdetools.py on lines 1003..1004
src/wafo/spectrum/core.py on lines 3094..3095
src/wafo/spectrum/models.py on lines 804..805
src/wafo/spectrum/models.py on lines 806..807
src/wafo/transform/estimation.py on lines 232..233
src/wafo/transform/estimation.py on lines 234..235

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

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

        if dtype is None:
            dtype = a.dtype
Severity: Major
Found in src/wafo/kdetools/gridding.py and 8 other locations - About 1 hr to fix
src/wafo/kdetools/gridding.py on lines 53..54
src/wafo/kdetools/gridding.py on lines 203..204
src/wafo/kdetools/kdetools.py on lines 1003..1004
src/wafo/spectrum/core.py on lines 3094..3095
src/wafo/spectrum/models.py on lines 804..805
src/wafo/spectrum/models.py on lines 806..807
src/wafo/transform/estimation.py on lines 232..233
src/wafo/transform/estimation.py on lines 234..235

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

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

    T[1], T[0] = T[0], T[1]
Severity: Major
Found in src/wafo/kdetools/gridding.py and 1 other location - About 1 hr to fix
src/wafo/integrate.py on lines 1268..1268

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

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

    dataset, x = np.atleast_2d(data, X)
Severity: Major
Found in src/wafo/kdetools/gridding.py and 30 other locations - About 55 mins to fix
src/wafo/containers.py on lines 203..203
src/wafo/demos.py on lines 13..13
src/wafo/demos.py on lines 23..23
src/wafo/graphutil.py on lines 214..215
src/wafo/integrate.py on lines 83..83
src/wafo/interpolate.py on lines 1161..1161
src/wafo/kdetools/kernels.py on lines 116..116
src/wafo/markov.py on lines 489..493
src/wafo/misc.py on lines 494..494
src/wafo/misc.py on lines 1334..1334
src/wafo/misc.py on lines 2429..2429
src/wafo/padua.py on lines 326..326
src/wafo/padua.py on lines 475..475
src/wafo/padua.py on lines 513..513
src/wafo/sg_filter/demos.py on lines 418..418
src/wafo/spectrum/models.py on lines 2099..2099
src/wafo/spectrum/models.py on lines 2108..2108
src/wafo/stats/_continuous_distns.py on lines 3779..3779
src/wafo/stats/core.py on lines 495..495
src/wafo/stats/core.py on lines 534..534
src/wafo/stats/core.py on lines 937..937
src/wafo/stats/estimation.py on lines 474..474
src/wafo/stats/estimation.py on lines 482..482
src/wafo/tests/test_gaussian.py on lines 47..47
src/wafo/tests/test_gaussian.py on lines 154..154
src/wafo/tests/test_misc.py on lines 546..546
src/wafo/tests/test_misc.py on lines 556..556
src/wafo/tests/test_misc.py on lines 569..569
src/wafo/transform/models.py on lines 231..231
src/wafo/transform/models.py on lines 240..240

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

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

        zero = np.zeros(len(binx))
Severity: Major
Found in src/wafo/kdetools/gridding.py and 9 other locations - About 55 mins to fix
src/wafo/kdetools/kdetools.py on lines 439..439
src/wafo/kdetools/kdetools.py on lines 463..463
src/wafo/markov.py on lines 120..120
src/wafo/markov.py on lines 345..345
src/wafo/markov.py on lines 367..367
src/wafo/markov.py on lines 611..611
src/wafo/sg_filter/demos.py on lines 281..281
src/wafo/stats/core.py on lines 438..439
src/wafo/stats/core.py on lines 584..585

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

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

    y = np.atleast_1d(y).ravel()
Severity: Major
Found in src/wafo/kdetools/gridding.py and 10 other locations - About 55 mins to fix
src/wafo/_misc_numba.py on lines 606..606
src/wafo/_misc_numba.py on lines 613..613
src/wafo/misc.py on lines 1318..1318
src/wafo/misc.py on lines 1392..1392
src/wafo/misc.py on lines 1713..1713
src/wafo/objects.py on lines 2562..2562
src/wafo/sg_filter/_core.py on lines 772..772
src/wafo/sg_filter/_core.py on lines 1195..1195
src/wafo/sg_filter/_core.py on lines 1198..1198
src/wafo/stats/_continuous_distns.py on lines 722..722

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

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

    out = np.empty(shape, dtype=dtype)
Severity: Major
Found in src/wafo/kdetools/gridding.py and 7 other locations - About 55 mins to fix
src/wafo/integrate_oscillating.py on lines 52..52
src/wafo/kdetools/kernels.py on lines 808..808
src/wafo/kdetools/kernels.py on lines 1008..1008
src/wafo/kdetools/kernels.py on lines 1112..1112
src/wafo/objects.py on lines 2570..2570
src/wafo/sg_filter/_core.py on lines 171..171
src/wafo/stats/tests/test_fit.py on lines 93..93

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

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

            indx = tuple(accmap[s])
Severity: Major
Found in src/wafo/kdetools/gridding.py and 5 other locations - About 55 mins to fix
src/wafo/covariance/core.py on lines 681..681
src/wafo/fig.py on lines 717..717
src/wafo/gaussian.py on lines 860..860
src/wafo/interpolate.py on lines 1139..1139
src/wafo/stats/estimation.py on lines 408..408

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

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

        adims = tuple(range(a.ndim))
Severity: Minor
Found in src/wafo/kdetools/gridding.py and 1 other location - About 55 mins to fix
src/wafo/dctpack.py on lines 174..175

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

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

        biny = accmap[:, 1]
Severity: Major
Found in src/wafo/kdetools/gridding.py and 3 other locations - About 50 mins to fix
src/wafo/graphutil.py on lines 246..247
src/wafo/interpolate.py on lines 388..388
src/wafo/kdetools/gridding.py on lines 60..60

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

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

        binx = accmap[:, 0]
Severity: Major
Found in src/wafo/kdetools/gridding.py and 3 other locations - About 50 mins to fix
src/wafo/graphutil.py on lines 246..247
src/wafo/interpolate.py on lines 388..388
src/wafo/kdetools/gridding.py on lines 61..61

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

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

    c = np.zeros((nc, ))
Severity: Major
Found in src/wafo/kdetools/gridding.py and 4 other locations - About 45 mins to fix
src/wafo/integrate_oscillating.py on lines 385..385
src/wafo/kdetools/kdetools.py on lines 764..764
src/wafo/kdetools/kdetools.py on lines 778..778
src/wafo/stats/core.py on lines 957..957

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

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

            b1 = np.sum((binx + bt0[one]) * fact1, axis=0)
Severity: Minor
Found in src/wafo/kdetools/gridding.py and 1 other location - About 45 mins to fix
src/wafo/transform/models.py on lines 349..349

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

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

    for ir in range(2 ** (d - 1)):
Severity: Minor
Found in src/wafo/kdetools/gridding.py and 1 other location - About 45 mins to fix
src/wafo/stats/_continuous_distns.py on lines 4500..4500

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

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

        out = sparse.coo_matrix(
            (a.ravel(), (binx, biny)), shape=shape, dtype=dtype).tocsr()
Severity: Minor
Found in src/wafo/kdetools/gridding.py and 1 other location - About 40 mins to fix
src/wafo/kdetools/gridding.py on lines 67..68

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

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

        out = sparse.coo_matrix(
            (a.ravel(), (binx, zero)), shape=(shape, 1), dtype=dtype).tocsr().T
Severity: Minor
Found in src/wafo/kdetools/gridding.py and 1 other location - About 40 mins to fix
src/wafo/kdetools/gridding.py on lines 62..63

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

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

        bt0[0] = np.reshape(bitget(ir, np.arange(d)), (d, -1))
Severity: Minor
Found in src/wafo/kdetools/gridding.py and 1 other location - About 40 mins to fix
src/wafo/stats/estimation.py on lines 1687..1687

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

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

        return _gridcount_1d(acfun, dataset, x, y, w, binx, inc)
Severity: Minor
Found in src/wafo/kdetools/gridding.py and 2 other locations - About 35 mins to fix
src/wafo/interpolate.py on lines 1158..1158
src/wafo/sg_filter/_core.py on lines 713..713

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

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

    fact1 = np.asarray(np.reshape(c_shape.cumprod() / inc, (d, -1)), dtype=int)
Severity: Minor
Found in src/wafo/kdetools/gridding.py and 2 other locations - About 35 mins to fix
src/wafo/stats/core.py on lines 372..372
src/wafo/stats/core.py on lines 376..376

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

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

        vals = np.empty(shape, dtype='O')
Severity: Minor
Found in src/wafo/kdetools/gridding.py and 1 other location - About 35 mins to fix
src/wafo/containers.py on lines 629..629

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

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

    d, inc = x.shape
Severity: Major
Found in src/wafo/kdetools/gridding.py and 24 other locations - About 30 mins to fix
src/wafo/doc/tutorial_scripts/chapter5.py on lines 187..187
src/wafo/gaussian.py on lines 335..335
src/wafo/gaussian.py on lines 717..717
src/wafo/graphutil.py on lines 238..238
src/wafo/kdetools/gridding.py on lines 341..341
src/wafo/kdetools/kdetools.py on lines 226..226
src/wafo/kdetools/kdetools.py on lines 709..709
src/wafo/kdetools/kdetools.py on lines 759..759
src/wafo/kdetools/kdetools.py on lines 773..773
src/wafo/kdetools/kdetools.py on lines 805..805
src/wafo/kdetools/kernels.py on lines 755..755
src/wafo/kdetools/kernels.py on lines 799..799
src/wafo/kdetools/kernels.py on lines 885..885
src/wafo/kdetools/kernels.py on lines 999..999
src/wafo/kdetools/kernels.py on lines 1103..1103
src/wafo/kdetools/kernels.py on lines 1230..1230
src/wafo/misc.py on lines 1188..1188
src/wafo/misc.py on lines 2885..2885
src/wafo/spectrum/core.py on lines 4114..4114
src/wafo/stats/core.py on lines 951..951
src/wafo/stats/core.py on lines 952..952
src/wafo/stats/core.py on lines 953..953
src/wafo/stats/core.py on lines 1253..1253
src/wafo/stats/core.py on lines 1353..1353

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

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

    d, inc = x.shape
Severity: Major
Found in src/wafo/kdetools/gridding.py and 24 other locations - About 30 mins to fix
src/wafo/doc/tutorial_scripts/chapter5.py on lines 187..187
src/wafo/gaussian.py on lines 335..335
src/wafo/gaussian.py on lines 717..717
src/wafo/graphutil.py on lines 238..238
src/wafo/kdetools/gridding.py on lines 230..230
src/wafo/kdetools/kdetools.py on lines 226..226
src/wafo/kdetools/kdetools.py on lines 709..709
src/wafo/kdetools/kdetools.py on lines 759..759
src/wafo/kdetools/kdetools.py on lines 773..773
src/wafo/kdetools/kdetools.py on lines 805..805
src/wafo/kdetools/kernels.py on lines 755..755
src/wafo/kdetools/kernels.py on lines 799..799
src/wafo/kdetools/kernels.py on lines 885..885
src/wafo/kdetools/kernels.py on lines 999..999
src/wafo/kdetools/kernels.py on lines 1103..1103
src/wafo/kdetools/kernels.py on lines 1230..1230
src/wafo/misc.py on lines 1188..1188
src/wafo/misc.py on lines 2885..2885
src/wafo/spectrum/core.py on lines 4114..4114
src/wafo/stats/core.py on lines 951..951
src/wafo/stats/core.py on lines 952..952
src/wafo/stats/core.py on lines 953..953
src/wafo/stats/core.py on lines 1253..1253
src/wafo/stats/core.py on lines 1353..1353

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

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

def _gridcount_1d(acfun, data, x, y, w, binx, inc):
Severity: Major
Found in src/wafo/kdetools/gridding.py and 3 other locations - About 30 mins to fix
src/wafo/covariance/core.py on lines 505..507
src/wafo/objects.py on lines 258..258
src/wafo/transform/models.py on lines 389..389

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

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

There are no issues that match your filters.

Category
Status