LiberTEM/LiberTEM

View on GitHub

Showing 267 of 911 total issues

Function insert_at_pos has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def insert_at_pos(el: Any,
                  coords: list[tuple[type, Any]],
                  nest: Iterable,
                  merge_fns: dict[type, Callable[[Iterable, Any, Any], None]]):
    """
Severity: Minor
Found in src/libertem/executor/utils/delayed_unpack.py - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function xml_defect_coord_extractor has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def xml_defect_coord_extractor(bad_pixel_map, map_index, map_sizes):
    """
    returns the chosen bad pixel map's defects

    Parameters
Severity: Minor
Found in src/libertem/io/dataset/seq.py - About 2 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function 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

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

    def __init__(
            self, dataset, udf, roi=None, channel=None, title=None, min_delta=0, udfresult=None
    ):
        if udfresult is None:
            udfresult = UDFRunner.dry_run([udf], dataset, roi)
Severity: Minor
Found in src/libertem/viz/base.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_udf_results has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def get_udf_results(self, udf_results, roi, damage):
        '''
        The AnalysisResults are calculated lazily in this function to reduce
        overhead.
        '''
Severity: Minor
Found in src/libertem/analysis/radialfourier.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 initialize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    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 - 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 _run_tile has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def _run_tile(
        self,
        udfs_and_methods: Iterable[
            tuple[
                UDF,
Severity: Minor
Found in src/libertem/udf/base.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 HDF5ParamsForm has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

const HDF5ParamsForm: React.FC<MergedProps> = ({
    values,
    info,
    isSubmitting,
    handleSubmit,
Severity: Minor
Found in client/src/dataset/components/HDF5ParamsForm.tsx - 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 sync_sectors has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def sync_sectors(self):
        for b in self.first_blocks():
            assert b.is_valid, "first block is not valid!"
        # sync up all sectors to start with the same `block_count`
        block_with_max_idx = sorted(self.first_blocks(), key=lambda b: b.header['block_count'])[-1]
Severity: Minor
Found in src/libertem/io/dataset/k2is.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 adjust has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

def adjust(adjusted_shape_inout, sig_shape, base_shape, excluded_list):
    '''
    Adjust the tile shape to avoid collisions with patched pixels.

    Find a tile shape that is a multiple of base_shape in such a way that
Severity: Minor
Found in src/libertem/io/corrections/corrset.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 full_match has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def full_match(
            self, centers, zero=None, cand=None,
            refineds=None, peak_values=None, peak_elevations=None):
        '''
        This function extracts a list of Match objects as well two PointSelection objects
Severity: Minor
Found in src/libertem/analysis/fullmatch.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 initialize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    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 - 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_results has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def get_results(self):
        com_params = self.get_params()
        raw_mask_result = self.results.get_buffer('raw_mask_result')
        raw_shifts = center_shifts(
            img_sum=raw_mask_result.data[..., 0],
Severity: Minor
Found in src/libertem/udf/com.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 _run_udfs has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def _run_udfs(
        self,
        ds_backend: ArrayBackend,
        execution_plan: ExecutionPlan,
        partition: Partition,
Severity: Minor
Found in src/libertem/udf/base.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 directoryBrowserReducer has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const directoryBrowserReducer = (state: DirectoryBrowserState = initialBrowserState, action: AllActions): DirectoryBrowserState => {
    switch (action.type) {
        case configActions.ActionTypes.FETCHED: {
            return Object.assign({}, state, {
                path: action.payload.config.cwd,
Severity: Minor
Found in client/src/browser/reducers.ts - About 1 hr to fix

    Function configReducer has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const configReducer = (state = initialConfigState, action: AllActions): ConfigState => {
        switch (action.type) {
            case configActions.ActionTypes.FETCHED: {
                return Object.assign({}, action.payload.config, { haveConfig: true });
            }
    Severity: Minor
    Found in client/src/config/reducers.ts - About 1 hr to fix

      Function getFormInitial has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function openDatasetReducer has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const openDatasetReducer = (state = initialOpenDatasetState, action: AllActions): OpenDatasetState => {
            switch (action.type) {
                case datasetActions.ActionTypes.OPEN: {
                    return {
                        ...state,
        Severity: Minor
        Found in client/src/dataset/reducers.ts - About 1 hr to fix

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

              def _compute_masks(self) -> Union[np.ndarray, sparse.COO, sparse.GCXS]:
                  """
                  Call mask factories and combine into a mask stack
          
                  Uses the internal attr self._use_sparse, which could be None
          Severity: Minor
          Found in src/libertem/common/container.py - 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 disjunct_multiplier has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          def disjunct_multiplier(excluded, sig_shape, base_shape=1, target=1):
              '''
              Calculate an integer i close to target which is a multiple of base_shape
              and for which i * n not in "excluded" for any n > 0, i * n < sig_shape.
          
          
          Severity: Minor
          Found in src/libertem/io/corrections/corrset.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

          Severity
          Category
          Status
          Source
          Language