Showing 89 of 113 total issues
Function get_dataset_and_preprocess
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_dataset_and_preprocess(
Avoid deeply nested control flow statements. Open
if np.sum((values - values_init) ** 2) > 0:
break
Avoid deeply nested control flow statements. Open
if np.max(im_data) > 255.0:
im_data = ((im_data + 285) / (3770 + 285)) * 255.0 # rescale image
img = nib.Nifti1Image(im_data, affine=None)
nib.save(img, os.path.join(data_dir, folder, subfolder, file))
if np.max(img.dataobj) > 255.0:
Function gif_warp
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def gif_warp(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function build_up_sampling_block
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_up_sampling_block(
Function get_dataset_and_preprocess
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_dataset_and_preprocess(
self,
training: bool,
batch_size: int,
repeat: bool,
- 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 __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function build_up_sampling_block
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def build_up_sampling_block(
Avoid deeply nested control flow statements. Open
if "T1" in file:
arr = nib.load(
os.path.join(path_to_data, folder, sub_folder, file)
).get_data()
img = nib.Nifti1Image(arr, affine=np.eye(4))
Avoid deeply nested control flow statements. Open
if case in file:
os.chdir(os.path.join(path_to_train, folder))
source = file
destination = os.path.join(path_to_test, folder)
shutil.move(source, destination)
Avoid deeply nested control flow statements. Open
if np.max(im_data) > 255.0:
im_data = ((im_data + 285) / (3770 + 285)) * 255.0 # rescale image
img = nib.Nifti1Image(im_data, affine=None)
nib.save(img, os.path.join(data_dir, folder, subfolder, file))
if np.max(img.dataobj) > 255.0:
Function predict_on_dataset
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def predict_on_dataset(
Function remove_prefix_suffix
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def remove_prefix_suffix(
x: str, prefix: Union[str, List[str]], suffix: Union[str, List[str]]
) -> str:
"""
Remove the prefix and suffix from a string,
- 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 __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function sample_image_label
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def sample_image_label(
Function get_data_loader
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_data_loader(data_config: dict, split: str) -> Optional[DataLoader]:
"""
Return the corresponding data loader.
Can't be placed in the same file of loader interfaces as it causes import cycle.
- 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"