LiberTEM/LiberTEM

View on GitHub

Showing 916 of 916 total issues

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

    def _adapt_chunking(self, array, sig_dims):
        n_dimension = array.ndim
        # Handle chunked signal dimensions by merging just in case
        sig_dim_idxs = [*range(n_dimension)[-sig_dims:]]
        if any([len(array.chunks[c]) > 1 for c in sig_dim_idxs]):
Severity: Minor
Found in src/libertem/io/dataset/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_with. (23)
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    @classmethod
    def make_with(
        cls,
        executor_spec: ExecutorSpecType = 'dask',
        *,
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

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

import typing
import os

import scipy.sparse
import numpy as np
Severity: Major
Found in src/libertem/io/dataset/raw_csr.py - About 4 hrs to fix

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

    def _execution_plan(
        udfs, ds: Union[DataSet, DataSetMeta], device_class: Optional[DeviceClass] = None,
        available_backends: Iterable[ArrayBackend] = BACKENDS
    ) -> tuple[ArrayBackend, ExecutionPlan]:
        '''
    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

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

        def _read_metadata(cls, path, use_ds=None):
            with ncempy.io.dm.fileDM(path, on_memory=True) as fp:
                tags = fp.allTags
                array_map = {}
                start_from = 1 if fp.thumbnail else 0
    Severity: Minor
    Found in src/libertem/io/dataset/dm_single.py - About 4 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 state.py has 492 lines of code (exceeds 400 allowed). Consider refactoring.
    Open
    • Open
    • Confirmed
    • Invalid
    • Wontfix
    Cancel

    import os
    import copy
    import typing
    import itertools
    import logging
    Severity: Minor
    Found in src/libertem/web/state.py - About 4 hrs to fix

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

          @classmethod
          def _read_metadata(cls, path, use_ds=None):
              with ncempy.io.dm.fileDM(path, on_memory=True) as fp:
                  tags = fp.allTags
                  array_map = {}
      Severity: Minor
      Found in src/libertem/io/dataset/dm_single.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

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

      const DatasetOpen = () => {
          const dispatch = useDispatch();
          const openState = useSelector((state: RootReducer) => state.openDataset);
      
          const [didReset, setReset] = React.useState(false);
      Severity: Major
      Found in client/src/dataset/components/DatasetOpen.tsx - About 4 hrs to fix

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

        def worker_loop(
            queues: WorkerQueues,
            work_mem: dict,
            worker_idx: int,
            env: Environment
        Severity: Minor
        Found in src/libertem/executor/pipelined.py - About 4 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 prime_numba_cache has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open
        • Open
        • Confirmed
        • Invalid
        • Wontfix
        Cancel

        def prime_numba_cache(ds):
            dtypes = (np.float32, None)
            for dtype in dtypes:
                roi = np.zeros(ds.shape.nav, dtype=bool).reshape((-1,))
                roi[max(-ds._meta.sync_offset, 0)] = True
        Severity: Minor
        Found in src/libertem/web/dataset.py - About 4 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

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

                        <Grid.Row>
                            <Grid.Column width={4}>
                                {left}
                            </Grid.Column>
        
        
        client/src/compoundAnalysis/components/layouts/AnalysisLayoutThreeCol.tsx on lines 44..57

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 116.

        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

                        <Grid.Row>
                            <Grid.Column width={5}>
                                {left}
                            </Grid.Column>
        
        
        client/src/compoundAnalysis/components/layouts/AnalysisLayoutTwoRes.tsx on lines 46..59

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

        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

        export const getDirectoryListing = async (path: string): Promise<DirectoryListingResponse> => {
            const basePath = getApiBasePath();
            const url = `${basePath}browse/localfs/?path=${encodeURIComponent(path)}`;
            const r = await fetch(url, {
                method: 'GET',
        Severity: Major
        Found in client/src/browser/api.ts and 1 other location - About 4 hrs to fix
        client/src/browser/api.ts on lines 14..22

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

        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

        export const getPathStat = async (path: string): Promise<StatResponse> => {
            const basePath = getApiBasePath();
            const url = `${basePath}browse/localfs/stat/?path=${encodeURIComponent(path)}`;
            const r = await fetch(url, {
                method: 'GET',
        Severity: Major
        Found in client/src/browser/api.ts and 1 other location - About 4 hrs to fix
        client/src/browser/api.ts on lines 4..12

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

        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

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

        class Message:
            """
            possible messages - the translation of our python datatypes to json types
            """
        
        
        Severity: Minor
        Found in src/libertem/web/messages.py - About 3 hrs to fix

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

          class DataSet:
              # The default partition size in bytes
              MAX_PARTITION_SIZE = 512*1024*1024
          
              def __init__(self, io_backend: Optional["IOBackend"] = None):
          Severity: Minor
          Found in src/libertem/io/dataset/base/dataset.py - About 3 hrs to fix

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

            def combine_slices_multid(slices1, slices2, shape):
                null_slice = slice(None, None, None)
            
                if not isinstance(slices1, tuple):
                    slices1 = (slices1,)

            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 main. (18)
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

            @click.command()
            @click.option('-h', '--host', help='host on which the server should listen on',
                          default="localhost", type=str, show_default=True)
            @click.option('-p', '--port', help='port on which the server should listen on, [default: 9000]',
                          default=None, type=int)
            Severity: Minor
            Found in src/libertem/web/cli.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 radial_bins. (18)
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

            def radial_bins(centerX, centerY, imageSizeX, imageSizeY,
                    radius=None, radius_inner=0, n_bins=None, normalize=False, use_sparse=None, dtype=None):
                '''
                Generate antialiased rings
                '''
            Severity: Minor
            Found in src/libertem/masks.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

            Function _run_sync has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            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 - About 3 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 make_with has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

                def make_with(
                    cls,
                    executor_spec: ExecutorSpecType = 'dask',
                    *,
                    cpus: Optional[Union[int, Iterable[int]]] = None,
            Severity: Minor
            Found in src/libertem/api.py - About 3 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 initialize. (17)
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

                def initialize(self, executor):
                    nav_shape_from_XML = None
                    lowpath = self._path.lower()
                    if lowpath.endswith(".xml"):
                        self._path_raw, nav_shape_from_XML = executor.run_function(
            Severity: Minor
            Found in src/libertem/io/dataset/empad.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

                        <Segment>
                            <List.Item>
                                <List.Content>Number of hosts : {clustOverview.host}</List.Content>
                                <List.Content>Number of CPU workers : {clustOverview.cpu}</List.Content>
                                <List.Content>Number of CUDA workers : {clustOverview.cuda}</List.Content>
            Severity: Major
            Found in client/src/clusterStatus/components/TCPStatus.tsx and 1 other location - About 3 hrs to fix
            client/src/clusterStatus/components/TCPStatus.tsx on lines 48..54

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

            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

                    <Segment key={node.host}>
                        <List.Item >
                            <List.Content>Host : {node.host}</List.Content>
                            <List.Content>Number of CPU workers : {node.cpu}</List.Content>
                            <List.Content>Number of CUDA workers : {node.cuda}</List.Content>
            Severity: Major
            Found in client/src/clusterStatus/components/TCPStatus.tsx and 1 other location - About 3 hrs to fix
            client/src/clusterStatus/components/TCPStatus.tsx on lines 59..65

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

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

            def make_get_read_ranges(
                px_to_bytes=_default_px_to_bytes,
                read_ranges_tile_block=_default_read_ranges_tile_block,
            ):
                """
            Severity: Minor
            Found in src/libertem/io/dataset/base/tiling.py - About 3 hrs to fix

            Cognitive Complexity

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

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

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

            Further reading

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

                    <Form.Field>
                        <label htmlFor="numWorkers">Number of Workers:</label>
                        <input type="number" name="numWorkers" value={values.numWorkers}
                            onChange={handleChange}
                            onBlur={handleBlur} />
            Severity: Major
            Found in client/src/cluster/components/LocalConnectionForm.tsx and 1 other location - About 3 hrs to fix
            client/src/cluster/components/TCPConnectionForm.tsx on lines 27..33

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

            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

                    <Form.Field>
                        <label htmlFor="address">Scheduler URI</label>
                        <input type="text" name="address" value={values.address}
                            onChange={handleChange}
                            onBlur={handleBlur} />
            Severity: Major
            Found in client/src/cluster/components/TCPConnectionForm.tsx and 1 other location - About 3 hrs to fix
            client/src/cluster/components/LocalConnectionForm.tsx on lines 32..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 105.

            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

            Cyclomatic complexity is too high in method __init__. (16)
            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 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 _correct_numba_inplace. (16)
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

            @numba.njit(cache=True, nogil=True)
            def _correct_numba_inplace(buffer, dark_image, gain_map, exclude_pixels, repair_environments,
                    repair_counts):
                '''
                Numerical work horse to perform detector corrections

            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('handles inputs without brackets', () => {
                    const inputErrors: ErrorObject[] = [
                        {
                            "keyword": "minimum",
                            "instancePath": ".nav_shape",
            Severity: Major
            Found in client/src/dataset/__tests__/validate.test.ts and 1 other location - About 3 hrs to fix
            client/src/dataset/__tests__/validate.test.ts on lines 9..21

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

            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 removes the dot and brackets', () => {
                    const inputErrors: ErrorObject[] = [
                        {
                            "keyword": "minimum",
                            "instancePath": ".nav_shape[1]",
            Severity: Major
            Found in client/src/dataset/__tests__/validate.test.ts and 1 other location - About 3 hrs to fix
            client/src/dataset/__tests__/validate.test.ts on lines 23..35

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

            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

            def get_git_rev():
                # NOTE: there is a copy of this code in hatch_build.py!
                try:
                    new_cwd = os.path.abspath(os.path.dirname(__file__))
                    rev_raw = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=new_cwd)
            Severity: Major
            Found in src/libertem/versioning.py and 1 other location - About 3 hrs to fix
            hatch_build.py on lines 7..14

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

            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

            def get_git_rev():
                # NOTE: Also exists in src/libertem/versioning.py
                try:
                    new_cwd = os.path.abspath(os.path.dirname(__file__))
                    rev_raw = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=new_cwd)
            Severity: Major
            Found in hatch_build.py and 1 other location - About 3 hrs to fix
            src/libertem/versioning.py on lines 5..12

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

            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 cached.py has 459 lines of code (exceeds 400 allowed). Consider refactoring.
            Open
            • Open
            • Confirmed
            • Invalid
            • Wontfix
            Cancel

            import os
            import json
            import hashlib
            import sqlite3
            import time
            Severity: Minor
            Found in src/libertem/io/dataset/cached.py - About 3 hrs to fix

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

                  def initialize(self, executor: JobExecutor):
                      self._filesize = executor.run_function(self._get_filesize)
                      files = executor.run_function(get_filenames, self._path)
              
                      # The series header is contained in the first file:
              Severity: Minor
              Found in src/libertem/io/dataset/tvips.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 __init__. (15)
              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 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 __init__. (15)
              Open
              • Open
              • Confirmed
              • Invalid
              • Wontfix
              Cancel

                  def __init__(self, masks: MaskContainer, meta: UDFMeta, use_torch: bool):
                      self.masks = masks
                      self.meta = meta
              
                      try:
              Severity: Minor
              Found in src/libertem/udf/masks.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

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

              def block_get_min_fill_factor(rrs):
                  """
                  Try to find out how sparse the given read ranges are, per file.
              
                  Returns the smallest fill factor and maximum required buffer size.
              Severity: Minor
              Found in src/libertem/io/dataset/base/backend_buffered.py - About 3 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 function _build_sparse. (14)
              Open
              • Open
              • Confirmed
              • Invalid
              • Wontfix
              Cancel

              def _build_sparse(m, dtype: npt.DTypeLike, sparse_backend: SparseSupportedT, backend: ArrayBackend):
                  if sparse_backend == 'sparse.pydata' and backend == NUMPY:
                      # sparse.pydata.org is fastest for masks with few layers
                      # and few entries
                      return m.astype(dtype)
              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

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

                  def get_scheme(
                          self,
                          udfs: Sequence[UDFProtocol],
                          dataset,
                          read_dtype: "nt.DTypeLike",

              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

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

              export const jobReducer = (state = initialJobState, action: AllActions): JobReducerState => {
                  switch (action.type) {
                      case jobActions.ActionTypes.CREATE: {
                          const createResult = insertById(
                              state,
              Severity: Major
              Found in client/src/job/reducers.ts - About 3 hrs to fix

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

                from io import SEEK_SET
                import math
                import os
                import re
                from typing import IO, TYPE_CHECKING, NamedTuple, Optional
                Severity: Minor
                Found in src/libertem/io/dataset/tvips.py - About 3 hrs to fix

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

                      def _apply_part_result(self, udfs: Iterable[UDF], damage, part_results, task):
                          for part_results_udf, udf in zip(part_results, udfs):
                              # Allow user to define an alternative merge strategy
                              # using dask-compatible functions. In the Delayed case we
                              # won't be getting partial results with damage anyway.
                  Severity: Minor
                  Found in src/libertem/executor/delayed.py - About 3 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 getFormInitial has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open
                  • Open
                  • Confirmed
                  • Invalid
                  • Wontfix
                  Cancel

                  const getFormInitial = (didReset: boolean, openState: OpenDatasetState) => {
                      const { formCachedParams, formDetectedParams } = openState;
                      if (didReset) {
                          if (formDetectedParams) {
                              return {
                  Severity: Minor
                  Found in client/src/dataset/components/DatasetOpen.tsx - About 3 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

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

                  class UDFData:
                      '''
                      Container for result buffers, return value from running UDFs
                      '''
                  
                  
                  Severity: Minor
                  Found in src/libertem/udf/base.py - About 3 hrs to fix

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

                    class UDFBase(UDFProtocol):
                        '''
                        Base class for UDFs with helper functions.
                        '''
                        def __init__(self, *args, **kwargs) -> None:
                    Severity: Minor
                    Found in src/libertem/udf/base.py - About 3 hrs to fix

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

                          def _apply_part_result(self, udfs: Iterable[UDF], damage, part_results, task):
                              for part_results_udf, udf in zip(part_results, udfs):
                                  # Allow user to define an alternative merge strategy
                                  # using dask-compatible functions. In the Delayed case we
                                  # won't be getting partial results with damage anyway.
                      Severity: Minor
                      Found in src/libertem/executor/delayed.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 detect_shape. (13)
                      Open
                      • Open
                      • Confirmed
                      • Invalid
                      • Wontfix
                      Cancel

                      def detect_shape(path: str) -> tuple[int, tuple[int, ...]]:
                          series_header = read_series_header(path)
                      
                          if series_header.version != 2:
                              raise DetectionError(
                      Severity: Minor
                      Found in src/libertem/io/dataset/tvips.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 _prepare_run_for_dataset. (13)
                      Open
                      • Open
                      • Confirmed
                      • Invalid
                      • Wontfix
                      Cancel

                          def _prepare_run_for_dataset(
                              self,
                              dataset: DataSet,
                              executor: JobExecutor,
                              roi: Optional[np.ndarray],
                      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 __init__. (13)
                      Open
                      • Open
                      • Confirmed
                      • Invalid
                      • Wontfix
                      Cancel

                          def __init__(self, mask_factories, use_torch=True, use_sparse=None, mask_count=None,
                                      mask_dtype=None, preferred_dtype=None, backends=None, shifts=None, **kwargs):
                      
                              _backends = backends
                              not_supported = (
                      Severity: Minor
                      Found in src/libertem/udf/masks.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