LiberTEM/LiberTEM

View on GitHub

Showing 491 of 903 total issues

Function "run" has 11 parameters, which is greater than the 7 authorized.
Open

    host, port, browser, local_directory, numeric_level,
    token, preload, strict_port, executor_spec, open_ds,
    snooze_timeout: Optional[float] = None,
Severity: Major
Found in src/libertem/web/server.py by sonar-python

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

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

def _correct_numba_inplace(buffer, dark_image, gain_map, exclude_pixels, repair_environments,

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

See

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

def correct_dot_masks(masks, gain_map, excluded_pixels=None, allow_empty=False):

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

See

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

    def _read_metadata(cls, path, use_ds=None):

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

See

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

    def _adapt_chunking(self, array, sig_dims):
Severity: Critical
Found in src/libertem/io/dataset/dask.py by sonar-python

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

See

Function "decode_swap_only_4" has 8 parameters, which is greater than the 7 authorized.
Open

def decode_swap_only_4(inp, out, idx, native_dtype, rr, origin, shape, ds_shape):

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

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

    def get_tiles(
Severity: Critical
Found in src/libertem/io/dataset/memory.py by sonar-python

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

See

Method "__init__" has 13 parameters, which is greater than the 7 authorized.
Open

            self, tolerance=3, min_weight=0.1, min_match=3, min_angle=np.pi/10,
            min_points=10, min_delta=0, max_delta=np.inf, min_candidates=3,
            max_candidates=7, clusterer=None, min_cluster_size_fraction=4,
            min_samples_fraction=20):

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Function "correct" has 8 parameters, which is greater than the 7 authorized.
Open

        buffer, dark_image=None, gain_map=None, excluded_pixels=None, repair_descriptor=None,
        inplace=False, sig_shape=None, allow_empty=False):

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

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

    def __init__(self, path, dtype, scan_size=None, detector_size=None, enable_direct=False,
Severity: Critical
Found in src/libertem/io/dataset/raw.py by sonar-python

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

See

Function "decode_swap_only_8" has 8 parameters, which is greater than the 7 authorized.
Open

def decode_swap_only_8(inp, out, idx, native_dtype, rr, origin, shape, ds_shape):

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Function "_get_read_ranges_inner" has 12 parameters, which is greater than the 7 authorized.
Open

        start_at_frame, stop_before_frame, roi_nonzero, depth,
        slices_arr, fileset_arr, sig_shape,
        bpp, sync_offset=0, extra=None, frame_header_bytes=0, frame_footer_bytes=0,

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Method "__init__" has 8 parameters, which is greater than the 7 authorized.
Open

            self, dataset, udf, roi=None, channel=None, title=None, min_delta=1/60, udfresult=None
Severity: Major
Found in src/libertem/viz/bqp.py by sonar-python

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Function "main" has 12 parameters, which is greater than the 7 authorized.
Open

def main(port, local_directory, browser, cpus, gpus, open_ds, log_level,
         insecure, host="localhost", token_path=None, preload: tuple[str, ...] = (),
         snooze_timeout: Optional[float] = None):
Severity: Major
Found in src/libertem/web/cli.py by sonar-python

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Method "__init__" has 8 parameters, which is greater than the 7 authorized.
Open

        self,
        path: os.PathLike,
        nav_shape: Optional[tuple[int, ...]] = None,
        sig_shape: Optional[tuple[int, ...]] = None,
        sync_offset: int = 0,

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Function "default_decode" has 8 parameters, which is greater than the 7 authorized.
Open

def default_decode(inp, out, idx, native_dtype, rr, origin, shape, ds_shape):

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

Function "decode_swap_4" has 8 parameters, which is greater than the 7 authorized.
Open

def decode_swap_4(inp, out, idx, native_dtype, rr, origin, shape, ds_shape):

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

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

def insert_at_pos(el: Any,

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

See

Method "get_tiles" has 11 parameters, which is greater than the 7 authorized.
Open

        self, decoder, tiling_scheme, fileset, read_ranges, roi, native_dtype, read_dtype,
        sync_offset, corrections, array_backend: ArrayBackend,

A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

Noncompliant Code Example

With a maximum number of 4 parameters:

def do_something(param1, param2, param3, param4, param5):
    ...

Compliant Solution

def do_something(param1, param2, param3, param4):
    ...

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

    def get_tiles(self, tiling_scheme: TilingScheme, dest_dtype="float32", roi=None,
Severity: Critical
Found in src/libertem/io/dataset/ser.py by sonar-python

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

See

Severity
Category
Status
Source
Language