fepegar/torchio

View on GitHub
src/torchio/transforms/transform.py

Summary

Maintainability
D
1 day
Test Coverage

File transform.py has 510 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import copy
import numbers
import warnings
from abc import ABC
from abc import abstractmethod
Severity: Major
Found in src/torchio/transforms/transform.py - About 1 day to fix

    Function __call__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def __call__(
            self,
            data: TypeTransformInput,
        ) -> TypeTransformInput:
            """Transform data and return a result of the same type.
    Severity: Minor
    Found in src/torchio/transforms/transform.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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in src/torchio/transforms/transform.py - About 1 hr to fix

      Function parse_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_params(self, params, around, name, make_ranges=True, **kwargs):
              params = to_tuple(params)
              # d or (a, b)
              if len(params) == 1 or (len(params) == 2 and make_ranges):
                  params *= 3  # (d, d, d) or (a, b, a, b, a, b)
      Severity: Minor
      Found in src/torchio/transforms/transform.py - About 45 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 get_mask_from_masking_method has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def get_mask_from_masking_method(
      Severity: Minor
      Found in src/torchio/transforms/transform.py - About 35 mins to fix

        Function parse_params has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def parse_params(self, params, around, name, make_ranges=True, **kwargs):
        Severity: Minor
        Found in src/torchio/transforms/transform.py - About 35 mins to fix

          Function _parse_range has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _parse_range(
          Severity: Minor
          Found in src/torchio/transforms/transform.py - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status