LiberTEM/LiberTEM

View on GitHub

Showing 902 of 903 total issues

Take the required action to fix the issue indicated by this "FIXME" comment.
Open

        # FIXME: hardcoded sig_dims

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

Remove or correct this useless self-assignment.
Open

        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

Take the required action to fix the issue indicated by this "FIXME" comment.
Open

            # 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 21 to the 15 allowed.
Open

    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

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

Take the required action to fix the issue indicated by this "FIXME" comment.
Open

        # FIXME: possibly different paths 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

Take the required action to fix the issue indicated by this "FIXME" comment.
Open

        # 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

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

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

    def get_scheme(

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 22 to the 15 allowed.
Open

    def _apply_part_result(self, udfs: Iterable[UDF], damage, part_results, task):
Severity: Critical
Found in src/libertem/executor/delayed.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

Remove this commented out code.
Open

        # from opentelemetry.sdk.trace.export import ConsoleSpanExporter
Severity: Major
Found in src/libertem/common/tracing.py by sonar-python

Programmers should not comment out code as it bloats programs and reduces readability.

Unused code should be deleted and can be retrieved from source control history if required.

See

  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

Take the required action to fix the issue indicated by this "FIXME" comment.
Open

        # FIXME: we don't have all parameters available here to actually construct
Severity: Major
Found in src/libertem/analysis/clust.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

    # 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

Remove this commented out code.
Open

        # if tileshape is None:

Programmers should not comment out code as it bloats programs and reduces readability.

Unused code should be deleted and can be retrieved from source control history if required.

See

  • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
  • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
  • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
  • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

Merge this if statement with the enclosing one.
Open

                if __has_pyfftw:

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

            # 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

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

Take the required action to fix the issue indicated by this "FIXME" comment.
Open

        return "results.tif"  # FIXME: naming

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 "__init__" has 13 parameters, which is greater than the 7 authorized.
Open

    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):
Severity: Major
Found in src/libertem/io/dataset/raw.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):
    ...

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

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):
    ...
Severity
Category
Status
Source
Language