LiberTEM/LiberTEM

View on GitHub

Showing 916 of 916 total issues

Function actionsFromChannel has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

export function* actionsFromChannel(socketChannel: SocketChannel) {
    try {
        while (true) {
            const msg = (yield take(socketChannel)) as channelMessages.Messages;
            const timestamp = Date.now();
Severity: Major
Found in client/src/channel/sagas.ts - About 2 hrs to fix

    Function __init__ has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

        def __init__(self, tileshape=None, num_partitions=None, data=None, sig_dims=None,
                     check_cast=True, tiledelay=None, datashape=None, base_shape=None,
                     force_need_decode=False, io_backend=None,
                     nav_shape=None, sig_shape=None, sync_offset=0, array_backends=None):
            super().__init__(io_backend=io_backend)
    Severity: Minor
    Found in src/libertem/io/dataset/memory.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

    Cyclomatic complexity is too high in method _prepare_plots. (12)
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

        def _prepare_plots(
            self,
            udfs: list[UDF],
            dataset: DataSet,
            roi: RoiT,
    Severity: Minor
    Found in src/libertem/api.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in function cluster_spec. (12)
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

    def cluster_spec(
        cpus: Union[int, Iterable[int]],
        cudas: Union[int, Iterable[int]],
        has_cupy: bool,
        name: str = 'default',
    Severity: Minor
    Found in src/libertem/executor/dask.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method make_local. (12)
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

        @classmethod
        def make_local(cls, spec: Optional[dict] = None, cluster_kwargs: Optional[dict] = None,
                client_kwargs: Optional[dict] = None, preload: Optional[tuple[str]] = None):
            """
            Spin up a local dask cluster
    Severity: Minor
    Found in src/libertem/executor/dask.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method _run_tile. (12)
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

        def _run_tile(
            self,
            udfs_and_methods: Iterable[
                tuple[
                    UDF,
    Severity: Minor
    Found in src/libertem/udf/base.py by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method validate. (12)
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

        def validate(
            self,
            shape: tuple[int, ...],
            ds_sig_shape: tuple[int, ...],
            size: int,

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Similar blocks of code found in 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.K2IS: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<K2ISParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.DM: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<DMParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.HDF5: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<HDF5ParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.RAW: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<RawFileParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.SER: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<SERParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.MIB: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<MIBParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.FRMS6: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<FRMS6ParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.EMPAD: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<EMPADParamsForm {...commonParams} initial={initial} info={info} />)
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.SEQ: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<SEQParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.TVIPS: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<TVIPSParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.NPY: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<NPYParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.BLO: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<BLOParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.MRC: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<MRCParamsForm {...commonParams} initial={initial} info={info} />);
            }
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 229..233
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 14 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

            case DatasetTypes.RAW_CSR: {
                const initial = formInitial && datasetType === formInitial.type ? formInitial : undefined;
                const info = formInfo && datasetType === formInfo.type ? formInfo : undefined;
                return renderForm(<RawCSRParamsForm {...commonParams} initial={initial} info={info} />);
            }        
    Severity: Major
    Found in client/src/dataset/components/DatasetOpen.tsx and 13 other locations - About 2 hrs to fix
    client/src/dataset/components/DatasetOpen.tsx on lines 169..173
    client/src/dataset/components/DatasetOpen.tsx on lines 174..178
    client/src/dataset/components/DatasetOpen.tsx on lines 179..183
    client/src/dataset/components/DatasetOpen.tsx on lines 184..188
    client/src/dataset/components/DatasetOpen.tsx on lines 189..193
    client/src/dataset/components/DatasetOpen.tsx on lines 194..198
    client/src/dataset/components/DatasetOpen.tsx on lines 199..203
    client/src/dataset/components/DatasetOpen.tsx on lines 204..208
    client/src/dataset/components/DatasetOpen.tsx on lines 209..213
    client/src/dataset/components/DatasetOpen.tsx on lines 214..218
    client/src/dataset/components/DatasetOpen.tsx on lines 219..223
    client/src/dataset/components/DatasetOpen.tsx on lines 224..228
    client/src/dataset/components/DatasetOpen.tsx on lines 234..238

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

    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 decode_r1_swap_2x2 has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

    def decode_r1_swap_2x2(inp, out, idx, native_dtype, rr, origin, shape, ds_shape):
        """
        RAW 1bit format: each pixel is actually saved as a single bit. 64 bits
        need to be unpacked together. This is the quad variant.
    
    
    Severity: Minor
    Found in src/libertem/io/dataset/mib.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 3 locations. Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

        def merge_all(self, ordered_results):
            ''
            intensity_chunks = [b.intensity for b in ordered_results.values()]
            intensity_sum = np.stack(intensity_chunks, axis=0).sum(axis=0)
            return {'intensity': intensity_sum}
    Severity: Major
    Found in src/libertem/udf/raw.py and 2 other locations - About 2 hrs to fix
    src/libertem/udf/logsum.py on lines 48..52
    src/libertem/udf/sum.py on lines 54..58

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

    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
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

        def merge_all(self, ordered_results):
            ''
            chunks = [b.logsum for b in ordered_results.values()]
            logsum = np.stack(chunks, axis=0).sum(axis=0)
            return {'logsum': logsum}
    Severity: Major
    Found in src/libertem/udf/logsum.py and 2 other locations - About 2 hrs to fix
    src/libertem/udf/raw.py on lines 73..77
    src/libertem/udf/sum.py on lines 54..58

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

    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
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

        def merge_all(self, ordered_results):
            ''
            intensity_chunks = [b.intensity for b in ordered_results.values()]
            intensity_sum = np.stack(intensity_chunks, axis=0).sum(axis=0)
            return {'intensity': intensity_sum}
    Severity: Major
    Found in src/libertem/udf/sum.py and 2 other locations - About 2 hrs to fix
    src/libertem/udf/logsum.py on lines 48..52
    src/libertem/udf/raw.py on lines 73..77

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

    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

    K2ISDataSet has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

    class K2ISDataSet(DataSet):
        """
        Read raw K2IS data sets. They consist of 8 .bin files and one .gtg file.
        Currently, data acquired using the STEMx unit is supported, metadata
        about the nav_shape is read from the .gtg file.
    Severity: Minor
    Found in src/libertem/io/dataset/k2is.py - About 2 hrs to fix

      Cyclomatic complexity is too high in method _run_tasks_inner. (11)
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

          def _run_tasks_inner(
              self,
              tasks: Iterable[TaskProtocol],
              params_handle: Any,
              cancel_id: Any,
      Severity: Minor
      Found in src/libertem/executor/pipelined.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method get_partitions. (11)
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

          def get_partitions(self):
              # ds_shape = Shape(self.shape, sig_dims=self.sig_dims)
              ds_shape: Shape = self.meta['ds_raw_shape']
              ds_slice = Slice(origin=[0] * len(ds_shape), shape=ds_shape)
              target_size = self.target_size
      Severity: Minor
      Found in src/libertem/io/dataset/hdf5.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _run_sync. (11)
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

          def _run_sync(
              self,
              dataset: DataSet,
              udf: Union[UDF, Iterable[UDF]],
              roi: RoiT,
      Severity: Minor
      Found in src/libertem/api.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in function get_fs_listing. (11)
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

      def get_fs_listing(path: str):
          try:
              abspath = Path(path).expanduser().resolve()
          # Triggered by empty DVD drive on Windows
          except PermissionError as e:
      Severity: Minor
      Found in src/libertem/io/fs.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _parse_header_bytes. (11)
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

          @staticmethod
          def _parse_header_bytes(header: bytes, filesize: int) -> HeaderDict:
              header: str = header.decode(encoding='ascii', errors='ignore')
              parts = header.split(",")
              header_size_bytes = int(parts[2])
      Severity: Minor
      Found in src/libertem/io/dataset/mib.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in function set_num_threads. (11)
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

      @contextmanager
      def set_num_threads(n):
          # Make sure modules that use BLAS are loaded
          import scipy  # noqa: F401
          import numpy as np  # noqa: F401
      Severity: Minor
      Found in src/libertem/common/threading.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in function block_get_min_fill_factor. (11)
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

      @numba.njit(cache=True, nogil=True)
      def block_get_min_fill_factor(rrs):
          """
          Try to find out how sparse the given read ranges are, per file.
      
      

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method validate_sync. (11)
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

          def validate_sync(self):
              # first blocks should be valid:
              first_blocks = self.first_blocks()
              frame_id = first_blocks[0].header['frame_id']
              for b in first_blocks:
      Severity: Minor
      Found in src/libertem/io/dataset/k2is.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _run_udfs. (11)
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

          def _run_udfs(
              self,
              ds_backend: ArrayBackend,
              execution_plan: ExecutionPlan,
              partition: Partition,
      Severity: Minor
      Found in src/libertem/udf/base.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

          test('properly handles positive offset', () => {
      
              const navShapeProduct = productOfShapeInCommaSeparatedString("8,8");
              const imageCount = 64;
              const offsetVal = 8;
      Severity: Major
      Found in client/src/dataset/__tests__/validate.test.ts and 1 other location - About 2 hrs to fix
      client/src/dataset/__tests__/validate.test.ts on lines 71..85

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

      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
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

          test('properly handles missing frames', () => {
      
              const navShapeProduct = productOfShapeInCommaSeparatedString("10,8");
              const imageCount = 64;
              const offsetVal = 0;
      Severity: Major
      Found in client/src/dataset/__tests__/validate.test.ts and 1 other location - About 2 hrs to fix
      client/src/dataset/__tests__/validate.test.ts on lines 39..53

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

      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 get_tiles has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

          def get_tiles(
              self, decoder, tiling_scheme, fileset, read_ranges, roi, native_dtype, read_dtype,
              sync_offset, corrections, array_backend: ArrayBackend,
          ):
              if roi is None:
      Severity: Minor
      Found in src/libertem/io/dataset/memory.py - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function __init__ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

          def __init__(self, path, dtype, scan_size=None, detector_size=None, enable_direct=False,
                       detector_size_raw=None, crop_detector_to=None, tileshape=None,
                       nav_shape=None, sig_shape=None, sync_offset=0, io_backend=None):
              if enable_direct and io_backend is not None:
                  raise ValueError("can't specify io_backend and enable_direct at the same time")
      Severity: Minor
      Found in src/libertem/io/dataset/raw.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

      File tiling_scheme.py has 424 lines of code (exceeds 400 allowed). Consider refactoring.
      Open
      • Open
      • Confirmed
      • Invalid
      • Wontfix
      Cancel

      import math
      import logging
      import warnings
      from typing import TYPE_CHECKING, Optional, Union
      from collections.abc import Sequence
      Severity: Minor
      Found in src/libertem/io/dataset/base/tiling_scheme.py - About 2 hrs to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open
        • Open
        • Confirmed
        • Invalid
        • Wontfix
        Cancel

            const onPickChange = (pickX: number, pickY: number) => {
                const newX = Math.round(pickX);
                const newY = Math.round(pickY);
                if (cx === newX && cy === newY) {
                    return;
        Severity: Major
        Found in client/src/compoundAnalysis/components/FramePicker.tsx and 1 other location - About 2 hrs to fix
        client/src/compoundAnalysis/components/FFTFramePicker.tsx on lines 30..38

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

        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
        • Open
        • Confirmed
        • Invalid
        • Wontfix
        Cancel

            const onPickChange = (pickX: number, pickY: number) => {
                const newX = Math.round(pickX);
                const newY = Math.round(pickY);
                if (cx === newX && cy === newY) {
                    return;
        Severity: Major
        Found in client/src/compoundAnalysis/components/FFTFramePicker.tsx and 1 other location - About 2 hrs to fix
        client/src/compoundAnalysis/components/FramePicker.tsx on lines 33..41

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

        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

        File gridmatching.py has 421 lines of code (exceeds 400 allowed). Consider refactoring.
        Open
        • Open
        • Confirmed
        • Invalid
        • Wontfix
        Cancel

        import warnings
        
        import numpy as np
        from libertem.utils import calc_coords, within_frame
        
        
        Severity: Minor
        Found in src/libertem/analysis/gridmatching.py - About 2 hrs to fix

          Messages has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open
          • Open
          • Confirmed
          • Invalid
          • Wontfix
          Cancel

          export const Messages = {
              initialState: (
                  jobs: MsgPartJob[],
                  datasets: MsgPartInitialDataset[],
                  analyses: MsgPartAnalysis[],
          Severity: Minor
          Found in client/src/channel/messages.ts - About 2 hrs to fix

            Cyclomatic complexity is too high in function disjunct_multiplier. (10)
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

            @numba.njit(cache=True)
            def disjunct_multiplier(excluded, sig_shape, base_shape=1, target=1):
                '''
                Calculate an integer i close to target which is a multiple of base_shape
                and for which i * n not in "excluded" for any n > 0, i * n < sig_shape.

            Cyclomatic Complexity

            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

            Construct Effect on CC Reasoning
            if +1 An if statement is a single decision.
            elif +1 The elif statement adds another decision.
            else +0 The else statement does not cause a new decision. The decision is at the if.
            for +1 There is a decision at the start of the loop.
            while +1 There is a decision at the while statement.
            except +1 Each except branch adds a new conditional path of execution.
            finally +0 The finally block is unconditionally executed.
            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
            assert +1 The assert statement internally roughly equals a conditional statement.
            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

            Source: http://radon.readthedocs.org/en/latest/intro.html

            Cyclomatic complexity is too high in method _get_decode_r. (10)
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

                def _get_decode_r(self):
                    bit_depth = self._bit_depth
                    layout = self._header['sensor_layout']
                    num_chips = self._header['num_chips']
                    if layout == (2, 2) and num_chips == 4:
            Severity: Minor
            Found in src/libertem/io/dataset/mib.py by radon

            Cyclomatic Complexity

            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

            Construct Effect on CC Reasoning
            if +1 An if statement is a single decision.
            elif +1 The elif statement adds another decision.
            else +0 The else statement does not cause a new decision. The decision is at the if.
            for +1 There is a decision at the start of the loop.
            while +1 There is a decision at the while statement.
            except +1 Each except branch adds a new conditional path of execution.
            finally +0 The finally block is unconditionally executed.
            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
            assert +1 The assert statement internally roughly equals a conditional statement.
            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

            Source: http://radon.readthedocs.org/en/latest/intro.html

            Cyclomatic complexity is too high in method get_read_ranges. (10)
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

                def get_read_ranges(
                    self, start_at_frame: int, stop_before_frame: int,
                    dtype, tiling_scheme: TilingScheme, sync_offset: int = 0,
                    roi: Union[np.ndarray, None] = None,
                ):
            Severity: Minor
            Found in src/libertem/io/dataset/mib.py by radon

            Cyclomatic Complexity

            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

            Construct Effect on CC Reasoning
            if +1 An if statement is a single decision.
            elif +1 The elif statement adds another decision.
            else +0 The else statement does not cause a new decision. The decision is at the if.
            for +1 There is a decision at the start of the loop.
            while +1 There is a decision at the while statement.
            except +1 Each except branch adds a new conditional path of execution.
            finally +0 The finally block is unconditionally executed.
            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
            assert +1 The assert statement internally roughly equals a conditional statement.
            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

            Source: http://radon.readthedocs.org/en/latest/intro.html

            Cyclomatic complexity is too high in function combine_slices. (10)
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

            def combine_slices(slice1, slice2, length):
                """
                https://stackoverflow.com/a/26783035
                Modified to support slices which are just element selection
                i.e. an integer for slice1 or slice2

            Cyclomatic Complexity

            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

            Construct Effect on CC Reasoning
            if +1 An if statement is a single decision.
            elif +1 The elif statement adds another decision.
            else +0 The else statement does not cause a new decision. The decision is at the if.
            for +1 There is a decision at the start of the loop.
            while +1 There is a decision at the while statement.
            except +1 Each except branch adds a new conditional path of execution.
            finally +0 The finally block is unconditionally executed.
            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
            assert +1 The assert statement internally roughly equals a conditional statement.
            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

            Source: http://radon.readthedocs.org/en/latest/intro.html

            Cyclomatic complexity is too high in method get_tiles. (10)
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

                def get_tiles(self, tiling_scheme: TilingScheme, dest_dtype="float32", roi=None,
                        array_backend: Optional[ArrayBackend] = None):
                    if array_backend is None:
                        array_backend = self.meta.array_backends[0]
                    assert array_backend in (NUMPY, CUDA)
            Severity: Minor
            Found in src/libertem/io/dataset/ser.py by radon

            Cyclomatic Complexity

            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

            Construct Effect on CC Reasoning
            if +1 An if statement is a single decision.
            elif +1 The elif statement adds another decision.
            else +0 The else statement does not cause a new decision. The decision is at the if.
            for +1 There is a decision at the start of the loop.
            while +1 There is a decision at the while statement.
            except +1 Each except branch adds a new conditional path of execution.
            finally +0 The finally block is unconditionally executed.
            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
            assert +1 The assert statement internally roughly equals a conditional statement.
            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

            Source: http://radon.readthedocs.org/en/latest/intro.html

            Cyclomatic complexity is too high in method _compute_masks. (10)
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

                def _compute_masks(self) -> Union[np.ndarray, sparse.COO, sparse.GCXS]:
                    """
                    Call mask factories and combine into a mask stack
            
                    Uses the internal attr self._use_sparse, which could be None
            Severity: Minor
            Found in src/libertem/common/container.py by radon

            Cyclomatic Complexity

            Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

            Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

            Construct Effect on CC Reasoning
            if +1 An if statement is a single decision.
            elif +1 The elif statement adds another decision.
            else +0 The else statement does not cause a new decision. The decision is at the if.
            for +1 There is a decision at the start of the loop.
            while +1 There is a decision at the while statement.
            except +1 Each except branch adds a new conditional path of execution.
            finally +0 The finally block is unconditionally executed.
            with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
            assert +1 The assert statement internally roughly equals a conditional statement.
            Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
            Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

            Source: http://radon.readthedocs.org/en/latest/intro.html

            Severity
            Category