src/libertem/common/numba/cache.py
Function _get_dependencies
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
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?
- Read upRead up
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
Open
jit_registry[MyCPU] = cached_njit # FIXME: is this needed?
- Read upRead up
- Exclude checks
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
- MITRE, CWE-546 - Suspicious Comment