Showing 916 of 916 total issues
Function log_message
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def log_message(message, exception=False):
log_fn = log.info
if exception:
log_fn = log.exception
if "job" in message:
- 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
Function adjust_event_loop_policy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def adjust_event_loop_policy():
"""
Set an appropriate event loop policy on Windows. The new one from Python 3.8 doesn't
work for us by default, so call this as early as possible!
"""
- 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
Function _setup_device
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _setup_device(spec: WorkerSpec, pin: bool):
"""
Set up this worker for its given task - either CPU or GPU comptation,
and maybe pin CPU workers to a given CPU core.
"""
- 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
Function _tags_to_nest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _tags_to_nest(tags: dict[str, Any]):
tags_nest = {}
for tag, element in tags.items():
tag = tag.strip('.')
_insert_to = tags_nest
- 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
Function detect_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def detect_params(cls, path: str, executor: "JobExecutor"):
try:
_, extension = os.path.splitext(path)
has_extension = extension.lstrip('.') in cls.get_supported_extensions()
under_size_lim = executor.run_function(cls._get_filesize, path) < 2**20 # 1 MB
- 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
Function numba_ravel_multi_index_multi
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def numba_ravel_multi_index_multi(multi_index, dims):
# only supports the "multi index" case
idxs = range(len(dims) - 1, -1, -1)
res = np.zeros(len(multi_index[0]), dtype=np.intp)
for i in range(len(res)):
- 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
Function _hdbscan_candidates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _hdbscan_candidates(self, points):
'''
Use hdbscan clustering to find potential candidates for lattice vectors.
We rely on the clusterer and its settings to give us tight and well-populated clusters.
- 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
Function decode_r6_swap_2x2
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decode_r6_swap_2x2(inp, out, idx, native_dtype, rr, origin, shape, ds_shape):
"""
RAW 6bit format: the pixels need to be re-ordered in groups of 8. `inp`
should have dtype uint8. This is the quad variant.
- 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
Function decode_r12_swap_2x2
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decode_r12_swap_2x2(inp, out, idx, native_dtype, rr, origin, shape, ds_shape):
"""
RAW 12bit format: the pixels need to be re-ordered in groups of 4. `inp`
should be an uint8 view on padded big endian 12bit data (">u2").
This is the quad variant.
- 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
Function webSocketSaga
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function* webSocketSaga() {
while (true) {
const socketChannel = (yield call(createWebSocketChannel)) as SocketChannel;
yield fork(actionsFromChannel, socketChannel);
const action = (yield take([channelActions.ActionTypes.OPEN, channelActions.ActionTypes.CLOSE])) as channelActions.Actions;
- 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
Function _set_skip_frames_and_nav_shape
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _set_skip_frames_and_nav_shape(self):
nav_shape = _get_nav_shape(self._path)
if nav_shape is not None:
# the sync flag appears to be set one frame too late, so
# we compensate here by setting a negative _skip_frames value.
- 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
Function get_tiles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_tiles(self, tiling_scheme, dest_dtype="float32", roi=None,
array_backend: Optional[ArrayBackend] = None):
if array_backend is None:
array_backend = self.meta.array_backends[0]
assert array_backend in (NUMPY, CUDA)
- 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
Function process_frame_shifted
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_frame_shifted(self, frame, shifts: tuple[int, ...]):
sig_shape = self.meta.dataset_shape.sig
masks = self._get_masks()
num_masks = len(self.masks)
shifted_slice = self.meta.sig_slice.shift_by(shifts)
- 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
Function _do_get_results
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _do_get_results(self) -> Mapping[str, BufferWrapper]:
results_tmp = self.get_results()
decl = self.get_result_buffers()
# include any results that were not explicitly included, but have non-private `use`:
- 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
Function process_tile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_tile(self, tile):
# Calculate a sum and variance minibatch for the tile and update partition buffers
# with it.
key = self.meta.tiling_scheme_idx
n_0 = self.task_data.num_frames[key]
- 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
Function useDefaultFrameView
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const useDefaultFrameView = ({
scanWidth, scanHeight, compoundAnalysisId, doAutoStart,
}: {
scanWidth: number, scanHeight: number, compoundAnalysisId: string,
doAutoStart: boolean,
- 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
Function _get_buffers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_buffers(
self, filter_allocated: bool = False
) -> Generator[tuple[str, AuxBufferWrapper], None, None]:
for k, buf in self._data.items():
if isinstance(buf, AuxBufferWrapper):
- 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
Function _find_file_for_frame_idx
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _find_file_for_frame_idx(fileset_arr, frame_idx):
"""
Find the file in `fileset_arr` that contains
`frame_idx` and return its index using binary search.
- 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
Function _get_subslices_chunked_tiled
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_subslices_chunked_tiled(self, tiling_scheme, scheme_lookup, nav_dims, tileshape_nd):
"""
general tiled reading w/ chunking outer loop is a chunk in
signal dimensions, inner loop is over "rows in nav"
"""
- 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
Function build_extension_map
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_extension_map() -> dict[str, list[str]]:
ext_map = {}
for typ_ in filetypes:
cls = get_dataset_cls(typ_)
for ext in cls.get_supported_extensions():
- 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
Refactor this function to reduce its Cognitive Complexity from 32 to the 15 allowed. Open
def radial_bins(centerX, centerY, imageSizeX, imageSizeY,
- Read upRead up
- Exclude checks
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
None, None, None, # FIXME: exc_type, exc_value, traceback?
- 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
Either merge this branch with the identical one on line "314" or change one of the implementations. Open
default = False
- Read upRead up
- Exclude checks
Having two branches in the same if
structure with the same implementation is at best duplicate code, and at worst a coding error. If
the same logic is truly needed for both instances, then they should be combined.
Noncompliant Code Example
if 0 <= a < 10: do_the_thing() elif 10 <= a < 20: do_the_other_thing() elif 20 <= a < 50: do_the_thing() # Noncompliant; duplicates first condition else: do_the_rest() b = 4 if a > 12 else 4
Compliant Solution
if (0 <= a < 10) or (20 <= a < 50): do_the_thing() elif 10 <= a < 20: do_the_other_thing() else: do_the_rest() b = 4
or
if 0 <= a < 10: do_the_thing() elif 10 <= a < 20: do_the_other_thing() elif 20 <= a < 50: do_the_third_thing() else: do_the_rest() b = 8 if a > 12 else 4
Take the required action to fix the issue indicated by this "FIXME" comment. Open
# FIXME `plt.colorbar()` creates error while testing
- 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
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):
- Read upRead up
- Exclude checks
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.npz" # FIXME: naming
- 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
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,
- Read upRead up
- Exclude checks
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
# console_exporter = ConsoleSpanExporter()
- Read upRead up
- Exclude checks
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 this might fail if the event loop policy has been overridden by something
- 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
Take the required action to fix the issue indicated by this "FIXME" comment. Open
# FIXME: concrete error message?
- 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
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,
- Read upRead up
- Exclude checks
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 "validate" has 8 parameters, which is greater than the 7 authorized. Open
self,
shape: tuple[int, ...],
ds_sig_shape: tuple[int, ...],
size: int,
io_max_size: int,
- Read upRead up
- Exclude checks
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 write and include documentation
- 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
Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed. Open
def _do_match(self, point_selection: grm.PointSelection, zero, polar_vectors):
- Read upRead up
- Exclude checks
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
# FIXME: implement this when we want to support CORS later
- 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
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,
- Read upRead up
- Exclude checks
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
# FIXME: are the dimensions the right way aroud? is there a sample file with a non-square
- 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
Method "__init__" has 8 parameters, which is greater than the 7 authorized. Open
def __init__(self, path, tileshape=None, endianess='<', nav_shape=None,
sig_shape=None, sync_offset=0, io_backend=None):
- Read upRead up
- Exclude checks
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_only_2" has 8 parameters, which is greater than the 7 authorized. Open
def decode_swap_only_2(inp, out, idx, native_dtype, rr, origin, shape, ds_shape):
- Read upRead up
- Exclude checks
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 20 to the 15 allowed. Open
def get_scheme(
- Read upRead up
- Exclude checks
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, dataset, udf, roi=None, channel=None, title=None, min_delta=1/60, udfresult=None
- Read upRead up
- Exclude checks
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
if __has_pyfftw:
- Read upRead up
- Exclude checks
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: we don't have all parameters available here to actually construct
- 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
Take the required action to fix the issue indicated by this "FIXME" comment. Open
# FIXME check later if the unknown root cause was fixed upstream
- 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
Take the required action to fix the issue indicated by this "FIXME" comment. Open
return "results.tif" # FIXME: naming
- 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
Take the required action to fix the issue indicated by this "FIXME" comment. Open
# FIXME include sample file for doctest, see Issue #86
- 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
Take the required action to fix the issue indicated by this "FIXME" comment. Open
# FIXME: let the UDF define upper bound for signal size (lower bound, too?)
- 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
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):
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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 write and include documentation
- 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