fepegar/torchio

View on GitHub
src/torchio/transforms/augmentation/intensity/random_labels_to_image.py

Summary

Maintainability
D
1 day
Test Coverage

File random_labels_to_image.py has 418 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from typing import List
from typing import Optional
from typing import Sequence
from typing import Tuple

    Function apply_transform has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def apply_transform(self, subject: Subject) -> Subject:
            original_image = subject.get(self.image_key)
    
            label_map_image = subject[self.label_key]
            label_map = label_map_image.data

    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 apply_transform has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def apply_transform(self, subject: Subject) -> Subject:
            if self.label_key is None:
                iterable = subject.get_images_dict(intensity_only=False).items()
                for name, image in iterable:
                    if isinstance(image, LabelMap):

    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 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(

      Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(

        There are no issues that match your filters.

        Category
        Status