iteal/wormpose

View on GitHub

Showing 45 of 47 total issues

Function make_draw_worm_body has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def make_draw_worm_body(body_color: int = 255) -> Callable:
    """
    Functor to draw a filled worm body on an image
    as a serie of quadrilaterals with some circles at the extremities

Severity: Minor
Found in wormpose/images/worm_drawing.py - About 35 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

Function _parse_arguments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def _parse_arguments(dataset_path: str, kwargs: dict):

    if kwargs.get("temp_dir") is None:
        kwargs["temp_dir"] = tempfile.gettempdir()
    if kwargs.get("draw_original") is None:
Severity: Minor
Found in wormpose/commands/visualize_results.py - About 35 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

Function _resolve_video_names has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _resolve_video_names(frames_dataset: BaseFramesDataset, selected_video_names: Optional[List[str]]):
    video_names = frames_dataset.video_names()

    if selected_video_names is not None:
        for video_name in selected_video_names:
Severity: Minor
Found in wormpose/dataset/loader.py - About 25 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

Function _eval_data_gen has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _eval_data_gen(filenames: List[str]):
    for filename in filenames:
        with open(filename, "rb") as f:
            while True:
                try:
Severity: Minor
Found in wormpose/commands/evaluate_model.py - About 25 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

Function make_calc_all_coords has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def make_calc_all_coords(nb_skeleton_joints: int, enable_random_augmentations: bool):
    """
    Calculates the coordinates of all the square patches along the worm body,
    for the template posture and the target posture, so we can do the affine transform later.
    The order of the coordinates list will define their drawing order
Severity: Minor
Found in wormpose/images/synthetic/_coord_transform.py - About 25 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

Severity
Category
Status
Source
Language