LiberTEM/LiberTEM

View on GitHub
src/libertem/io/dataset/mib.py

Summary

Maintainability
F
3 days
Test Coverage

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert self._files_sorted is not None
Severity: Info
Found in src/libertem/io/dataset/mib.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert self._files_sorted is not None
Severity: Info
Found in src/libertem/io/dataset/mib.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert self.meta is not None
Severity: Info
Found in src/libertem/io/dataset/mib.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert self.meta is not None and base_shape[-1] == self.meta.shape[-1]
Severity: Info
Found in src/libertem/io/dataset/mib.py by bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Open

        assert self._sequence_start is not None
Severity: Info
Found in src/libertem/io/dataset/mib.py by bandit

File mib.py has 973 lines of code (exceeds 400 allowed). Consider refactoring.
Open

import re
import os
from glob import glob, escape
import logging
from typing import TYPE_CHECKING, Generator, List, Optional, Sequence, Tuple, Union
Severity: Major
Found in src/libertem/io/dataset/mib.py - About 1 day to fix

    Cyclomatic complexity is too high in method read_header. (12)
    Open

        def read_header(self) -> HeaderDict:
            # FIXME: do this read via the IO backend!
            with open(file=self.path, encoding="ascii", errors='ignore') as f:
                header = f.read(1024)
                filesize = os.fstat(f.fileno()).st_size
    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

    Function decode_r1_swap_2x2 has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    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

    Cyclomatic complexity is too high in method get_read_ranges. (10)
    Open

        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 method _get_decode_r. (10)
    Open

        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 function decode_r1_swap_2x2. (8)
    Open

    @numba.njit(inline='always', cache=True, boundscheck=True)
    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 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__. (8)
    Open

        def __init__(self, path, tileshape=None, scan_size=None, disable_glob=False,
                     nav_shape=None, sig_shape=None, sync_offset=0, io_backend=None):
            super().__init__(io_backend=io_backend)
            self._sig_dims = 2
            self._path = path
    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 _mib_2x2_tile_block. (7)
    Open

    @numba.njit(inline="always", cache=True)
    def _mib_2x2_tile_block(
        slices_arr, fileset_arr, slice_sig_sizes, sig_origins,
        inner_indices_start, inner_indices_stop, frame_indices, sig_size,
        px_to_bytes, bpp, frame_header_bytes, frame_footer_bytes, file_idxs,
    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

    Function get_read_ranges has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        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 - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Cyclomatic complexity is too high in method _do_initialize. (6)
    Open

        def _do_initialize(self):
            self._headers = self._preread_headers()
            self._files_sorted = list(sorted(self._files(),
                                             key=lambda f: f.fields['sequence_first_image']))
    
    
    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_np_dtype. (6)
    Open

        def _get_np_dtype(self, dtype: str, bit_depth: int) -> "nt.DTypeLike":
            dtype = dtype.lower()
            num_bits = int(dtype[1:])
            if dtype[0] == "u":
                num_bytes = num_bits // 8
    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

    Function read_header has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def read_header(self) -> HeaderDict:
            # FIXME: do this read via the IO backend!
            with open(file=self.path, encoding="ascii", errors='ignore') as f:
                header = f.read(1024)
                filesize = os.fstat(f.fileno()).st_size
    Severity: Minor
    Found in src/libertem/io/dataset/mib.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function _mib_2x2_tile_block has 16 arguments (exceeds 8 allowed). Consider refactoring.
    Open

    def _mib_2x2_tile_block(
    Severity: Major
    Found in src/libertem/io/dataset/mib.py - About 1 hr to fix

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

      def _mib_2x2_tile_block(
          slices_arr, fileset_arr, slice_sig_sizes, sig_origins,
          inner_indices_start, inner_indices_stop, frame_indices, sig_size,
          px_to_bytes, bpp, frame_header_bytes, frame_footer_bytes, file_idxs,
          slice_offset, extra, sig_shape,
      Severity: Minor
      Found in src/libertem/io/dataset/mib.py - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          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 - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

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

      def encode_r1(inp, out):
          for y in range(out.shape[0]):
              row_out = out[y]
              row_in = inp[y]
              for stripe in range(row_out.shape[0] // 8):
      Severity: Minor
      Found in src/libertem/io/dataset/mib.py - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function _get_np_dtype has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_np_dtype(self, dtype: str, bit_depth: int) -> "nt.DTypeLike":
              dtype = dtype.lower()
              num_bits = int(dtype[1:])
              if dtype[0] == "u":
                  num_bytes = num_bits // 8
      Severity: Minor
      Found in src/libertem/io/dataset/mib.py - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function _mib_r24_px_to_bytes has 10 arguments (exceeds 8 allowed). Consider refactoring.
      Open

      def _mib_r24_px_to_bytes(
      Severity: Major
      Found in src/libertem/io/dataset/mib.py - About 45 mins to fix

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

            def __init__(self, path, tileshape=None, scan_size=None, disable_glob=False,
        Severity: Major
        Found in src/libertem/io/dataset/mib.py - About 35 mins to fix

          Function __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, path, tileshape=None, scan_size=None, disable_glob=False,
                           nav_shape=None, sig_shape=None, sync_offset=0, io_backend=None):
                  super().__init__(io_backend=io_backend)
                  self._sig_dims = 2
                  self._path = path
          Severity: Minor
          Found in src/libertem/io/dataset/mib.py - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function decode_r12_swap_2x2 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def decode_r12_swap_2x2(inp, out, idx, native_dtype, rr, origin, shape, ds_shape):
              """
              RAW 12bit format: the pixels need to be re-ordered in groups of 4. `inp`
              should be an uint8 view on padded big endian 12bit data (">u2").
              This is the quad variant.
          Severity: Minor
          Found in src/libertem/io/dataset/mib.py - About 25 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function decode_r1_swap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def decode_r1_swap(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.
              """
          Severity: Minor
          Found in src/libertem/io/dataset/mib.py - About 25 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function decode_r6_swap_2x2 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def decode_r6_swap_2x2(inp, out, idx, native_dtype, rr, origin, shape, ds_shape):
              """
              RAW 6bit format: the pixels need to be re-ordered in groups of 8. `inp`
              should have dtype uint8. This is the quad variant.
          
          
          Severity: Minor
          Found in src/libertem/io/dataset/mib.py - About 25 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          There are no issues that match your filters.

          Category
          Status