LiberTEM/LiberTEM

View on GitHub
src/libertem/common/numba/cache.py

Summary

Maintainability
A
55 mins
Test Coverage

Function _get_dependencies has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def _get_dependencies(self, cvar):
            deps = [cvar]
            if hasattr(cvar, 'py_func'):
                # TODO: does the cache key need to depend on any other
                # attributes of the Dispatcher?
Severity: Minor
Found in src/libertem/common/numba/cache.py - About 55 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

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

        jit_registry[MyCPU] = cached_njit  # FIXME: is this needed?

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

There are no issues that match your filters.

Category
Status