fepegar/torchio

View on GitHub
src/torchio/data/subject.py

Summary

Maintainability
C
1 day
Test Coverage

File subject.py has 365 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import annotations

import copy
import pprint
from typing import Any
Severity: Minor
Found in src/torchio/data/subject.py - About 4 hrs to fix

    Function get_images_dict has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_images_dict(
            self,
            intensity_only=True,
            include: Optional[Sequence[str]] = None,
            exclude: Optional[Sequence[str]] = None,
    Severity: Minor
    Found in src/torchio/data/subject.py - About 1 hr 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 check_consistent_attribute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def check_consistent_attribute(
            self,
            attribute: str,
            relative_tolerance: float = 1e-6,
            absolute_tolerance: float = 1e-6,
    Severity: Minor
    Found in src/torchio/data/subject.py - About 1 hr 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 check_consistent_attribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def check_consistent_attribute(
    Severity: Minor
    Found in src/torchio/data/subject.py - About 35 mins to fix

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

          def get_applied_transforms(
              self,
              ignore_intensity: bool = False,
              image_interpolation: Optional[str] = None,
          ) -> List[Transform]:
      Severity: Minor
      Found in src/torchio/data/subject.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

      There are no issues that match your filters.

      Category
      Status