Showing 916 of 916 total issues
Either remove or fill this block of code. Open
pass
- Read upRead up
- Exclude checks
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
def _read_metadata(cls, path, use_ds=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
Function "_frms6_read_ranges_tile_block" has 16 parameters, which is greater than the 7 authorized. Open
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,
- 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 execute deprecation after 0.6.0
- 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
Rename function "get_plottable_2D_channels" to match the regular expression ^[a-z_][a-z0-9_]{2,}$. Open
def get_plottable_2D_channels(buffers):
- Read upRead up
- Exclude checks
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
def hologram_frame(amp, phi,
counts=1000.,
sampling=5.,
visibility=1.,
f_angle=30.,
- 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 and __pyfftw_cached is not None:
- 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
return "results.h5" # FIXME: more specific name
- 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 19 to the 15 allowed. Open
def __init__(self, path, dtype, scan_size=None, detector_size=None, enable_direct=False,
- 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
Function "decode_swap_only_8" has 8 parameters, which is greater than the 7 authorized. Open
def decode_swap_only_8(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): ...
Take the required action to fix the issue indicated by this "FIXME" comment. Open
# FIXME we might want to use an external physics or coordinate system package
- 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 remove or fill this block of code. Open
pass
- Read upRead up
- Exclude checks
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
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):
- 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: 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
Take the required action to fix the issue indicated by this "FIXME" comment. Open
# FIXME: allow to set correction data for a dataset via upload and local loading
- 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 correct_dot_masks(masks, gain_map, excluded_pixels=None, allow_empty=False):
- 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: adjust size to L3 // number of workers per node
- 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 "results_for_dataset_sync" has 8 parameters, which is greater than the 7 authorized. Open
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]:
- 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 16 to the 15 allowed. Open
def environments(excluded_pixels, sigshape):
- 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
Function "_default_read_ranges_tile_block" has 16 parameters, which is greater than the 7 authorized. Open
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,
- 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 "radial_bins" has 10 parameters, which is greater than the 7 authorized. Open
def radial_bins(centerX, centerY, imageSizeX, imageSizeY,
radius=None, radius_inner=0, n_bins=None, normalize=False, use_sparse=None, dtype=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): ...
Remove or correct this useless self-assignment. Open
self._data = self._data
- Read upRead up
- Exclude checks
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
- CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
- CERT, MSC12-CPP. - Detect and remove code that has no effect
Function "main" has 9 parameters, which is greater than the 7 authorized. Open
def main(kind, scheduler, local_directory, n_cpus, cudas,
has_cupy, name, log_level, preload: tuple[str, ...]):
- 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 "radial_mask_factory" has 9 parameters, which is greater than the 7 authorized. Open
def radial_mask_factory(detector_y, detector_x, cx, cy, ri, ro, n_bins, max_order, use_sparse):
- 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: don't broadcast, only send to the websocket that matches this HTTP connection
- 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 "run" has 11 parameters, which is greater than the 7 authorized. Open
host, port, browser, local_directory, numeric_level,
token, preload, strict_port, executor_spec, open_ds,
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): ...
Either remove or fill this block of code. Open
pass
- Read upRead up
- Exclude checks
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
# FIXME: should we scale the data by the binning factor?
- 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 remove or fill this block of code. Open
pass
- Read upRead up
- Exclude checks
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
# 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
Take the required action to fix the issue indicated by this "FIXME" comment. Open
# FIXME: unused for now
- 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 temporary workaround, see if 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
Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed. Open
def _adapt_chunking(self, array, sig_dims):
- 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
Function "default_decode" has 8 parameters, which is greater than the 7 authorized. Open
def default_decode(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): ...
Take the required action to fix the issue indicated by this "FIXME" comment. Open
# FIXME: implement these 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
Function "correct" has 8 parameters, which is greater than the 7 authorized. Open
buffer, dark_image=None, gain_map=None, excluded_pixels=None, repair_descriptor=None,
inplace=False, sig_shape=None, allow_empty=False):
- 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 21 to the 15 allowed. Open
def initialize(self, executor):
- 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: make example executable? involves temporary directory, source dataset, ...
- 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: do this read via the IO backend!
- 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 "decode_swap_only_4" has 8 parameters, which is greater than the 7 authorized. Open
def decode_swap_only_4(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): ...
Function "_get_read_ranges_inner" has 12 parameters, which is greater than the 7 authorized. Open
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,
- 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 "__init__" has 8 parameters, which is greater than the 7 authorized. Open
self, dataset, udf, roi=None, channel=None, title=None,
min_delta=0.2, 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): ...
Take the required action to fix the issue indicated by this "FIXME" comment. Open
# FIXME: don't broadcast, only send to the new connection
- 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 insert_at_pos(el: Any,
- 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 more testing for optimum backend
- 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 "fastmatch" has 8 parameters, which is greater than the 7 authorized. Open
def fastmatch(self, centers, zero, a, b, refineds=None, peak_values=None, peak_elevations=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
# FIXME: add "metadata", for example, what analysis was run that
- 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: this veto may break if the base shape was adjusted
- 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 "cbed_frame" has 9 parameters, which is greater than the 7 authorized. Open
fy=128, fx=128, zero=None, a=None, b=None, indices=None,
radius=4, all_equal=False, margin=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 stop < 0:
- 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: # ...