LiberTEM/LiberTEM

View on GitHub

Showing 916 of 916 total issues

Either remove or fill this block of code.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        pass

Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.

Noncompliant Code Example

for i in range(3):
    pass

Exceptions

When a block contains a comment, this block is not considered to be empty.

Refactor this function to reduce its Cognitive Complexity from 29 to the 15 allowed.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    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

Function "_frms6_read_ranges_tile_block" has 16 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    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,

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):
    ...

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        # FIXME execute deprecation after 0.6.0
Severity: Major
Found in src/libertem/io/dataset/raw.py by sonar-python

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Rename function "get_plottable_2D_channels" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def get_plottable_2D_channels(buffers):
Severity: Major
Found in src/libertem/viz/base.py by sonar-python

Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

Noncompliant Code Example

With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

def MyFunction(a,b):
    ...

Compliant Solution

def my_function(a,b):
    ...

Function "hologram_frame" has 8 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def hologram_frame(amp, phi,
                   counts=1000.,
                   sampling=5.,
                   visibility=1.,
                   f_angle=30.,
Severity: Major
Found in src/libertem/utils/generate.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):
    ...

Merge this if statement with the enclosing one.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

                if __has_pyfftw and __pyfftw_cached is not None:

Merging collapsible if statements increases the code's readability.

Noncompliant Code Example

if condition1:
    if condition2:
        # ...

Compliant Solution

if condition1 and condition2:
    # ...

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        return "results.h5"  # FIXME: more specific name

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Refactor this function to reduce its Cognitive Complexity from 19 to the 15 allowed.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

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

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):
    ...

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

# FIXME we might want to use an external physics or coordinate system package
Severity: Major
Found in src/libertem/utils/__init__.py by sonar-python

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Either remove or fill this block of code.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

            pass
Severity: Major
Found in src/libertem/analysis/clust.py by sonar-python

Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.

Noncompliant Code Example

for i in range(3):
    pass

Exceptions

When a block contains a comment, this block is not considered to be empty.

Method "__init__" has 13 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

            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):
    ...

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

                # FIXME: concrete error message?
Severity: Major
Found in src/libertem/web/analysis.py by sonar-python

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        # FIXME: allow to set correction data for a dataset via upload and local loading
Severity: Major
Found in src/libertem/web/engine.py by sonar-python

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

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

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        # FIXME: adjust size to L3 // number of workers per node

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Method "results_for_dataset_sync" has 8 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def results_for_dataset_sync(self, dataset: DataSet, executor: 'DelayedJobExecutor',
            roi: Optional[np.ndarray] = None, progress: bool = False,
            corrections: Optional[CorrectionSet] = None, backends: Optional[BackendSpec] = None,
            dry: bool = False) -> Iterable[tuple]:

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

def environments(excluded_pixels, sigshape):

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 "_default_read_ranges_tile_block" has 16 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    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,

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 "radial_bins" has 10 parameters, which is greater than the 7 authorized.
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):
Severity: Major
Found in src/libertem/masks.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):
    ...

Remove or correct this useless self-assignment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        self._data = self._data

There is no reason to re-assign a variable to itself. Either this statement is redundant and should be removed, or the re-assignment is a mistake and some other value or variable was intended for the assignment instead.

Noncompliant Code Example

name = name

Compliant Solution

name = other.name

See

Function "main" has 9 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def main(kind, scheduler, local_directory, n_cpus, cudas,
         has_cupy, name, log_level, preload: tuple[str, ...]):
Severity: Major
Found in src/libertem/executor/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):
    ...

Function "radial_mask_factory" has 9 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

def radial_mask_factory(detector_y, detector_x, cx, cy, ri, ro, n_bins, max_order, use_sparse):

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):
    ...

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        # FIXME: don't broadcast, only send to the websocket that matches this HTTP connection
Severity: Major
Found in src/libertem/web/connect.py by sonar-python

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Function "run" has 11 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    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):
    ...

Either remove or fill this block of code.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

                pass

Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.

Noncompliant Code Example

for i in range(3):
    pass

Exceptions

When a block contains a comment, this block is not considered to be empty.

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    # FIXME: should we scale the data by the binning factor?

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Either remove or fill this block of code.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

            pass
Severity: Major
Found in src/libertem/analysis/clust.py by sonar-python

Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.

Noncompliant Code Example

for i in range(3):
    pass

Exceptions

When a block contains a comment, this block is not considered to be empty.

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    # FIXME write and include documentation

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        # FIXME: unused for now
Severity: Major
Found in src/libertem/web/analysis.py by sonar-python

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        # FIXME temporary workaround, see if fixed upstream:

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    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 "default_decode" has 8 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

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):
    ...

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    # FIXME: implement these when we want to support CORS later
Severity: Major
Found in src/libertem/web/base.py by sonar-python

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Function "correct" has 8 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        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 21 to the 15 allowed.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def initialize(self, executor):
Severity: Critical
Found in src/libertem/io/dataset/empad.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

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        # FIXME: make example executable? involves temporary directory, source dataset, ...

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        # FIXME: do this read via the IO backend!
Severity: Major
Found in src/libertem/io/dataset/blo.py by sonar-python

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Function "decode_swap_only_4" has 8 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

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):
    ...

Function "_get_read_ranges_inner" has 12 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

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

            self, dataset, udf, roi=None, channel=None, title=None,
            min_delta=0.2, udfresult=None,
Severity: Major
Found in src/libertem/viz/gms.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):
    ...

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

            # FIXME: don't broadcast, only send to the new connection
Severity: Major
Found in src/libertem/web/events.py by sonar-python

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

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

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        # FIXME more testing for optimum backend

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Method "fastmatch" has 8 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

    def fastmatch(self, centers, zero, a, b, refineds=None, peak_values=None, peak_elevations=None):

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):
    ...

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

            # FIXME: add "metadata", for example, what analysis was run that

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Take the required action to fix the issue indicated by this "FIXME" comment.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        # FIXME: this veto may break if the base shape was adjusted

FIXME tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.

Sometimes the developer will not have the time or will simply forget to get back to that tag.

This rule is meant to track those tags and to ensure that they do not go unnoticed.

Noncompliant Code Example

def divide(numerator, denominator):
  return numerator / denominator              # FIXME denominator value might be 0

See

Function "cbed_frame" has 9 parameters, which is greater than the 7 authorized.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        fy=128, fx=128, zero=None, a=None, b=None, indices=None,
        radius=4, all_equal=False, margin=None):
Severity: Major
Found in src/libertem/utils/generate.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):
    ...

Merge this if statement with the enclosing one.
Open
  • Open
  • Confirmed
  • Invalid
  • Wontfix
Cancel

        if stop < 0:

Merging collapsible if statements increases the code's readability.

Noncompliant Code Example

if condition1:
    if condition2:
        # ...

Compliant Solution

if condition1 and condition2:
    # ...
Severity
Category