fepegar/torchio

View on GitHub

Showing 108 of 108 total issues

Function plot_subject has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def plot_subject(
    subject: Subject,
    cmap_dict=None,
    show=True,
    output_path=None,
Severity: Minor
Found in src/torchio/visualization.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 __call__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def __call__(self, data: InputType) -> InputType:
        """Transform data and return a result of the same type.

        Args:
            data: Instance of :class:`torchio.Subject`, 4D
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 plot_volume has 13 arguments (exceeds 4 allowed). Consider refactoring.
Open

def plot_volume(
Severity: Major
Found in src/torchio/visualization.py - About 1 hr to fix

    Function plot_volume has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def plot_volume(
        image: Image,
        radiological=True,
        channel=-1,  # default to foreground for binary maps
        axes=None,
    Severity: Minor
    Found in src/torchio/visualization.py - About 1 hr to fix

      Function get_output has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_output(self, transformed):
              if self.is_tensor or self.is_sitk:
                  image = transformed[self.default_image_name]
                  transformed = image.data
                  if self.is_array:
      Severity: Minor
      Found in src/torchio/transforms/data_parser.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 get_subject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_subject(self):
              if isinstance(self.data, nib.Nifti1Image):
                  tensor = self.data.get_fdata(dtype=np.float32)
                  if tensor.ndim == 3:
                      tensor = tensor[np.newaxis]
      Severity: Minor
      Found in src/torchio/transforms/data_parser.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 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(

        Function create_dummy_dataset has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def create_dummy_dataset(
            num_images: int,
            size_range: Tuple[int, int],
            directory: Optional[TypePath] = None,
            suffix: str = '.nii.gz',
        Severity: Minor
        Found in src/torchio/utils.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 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

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

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

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

                def __init__(

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

              def main(
              Severity: Major
              Found in src/torchio/cli/apply_transform.py - About 1 hr to fix

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

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

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

                  def make_gif(
                  Severity: Major
                  Found in src/torchio/visualization.py - About 1 hr to fix

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

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

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

                          def to_gif(
                      Severity: Major
                      Found in src/torchio/data/image.py - About 1 hr 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 _get_subjects_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def _get_subjects_list(root, modalities):
                                # The number of files for each modality is not the same
                                # E.g. 581 for T1, 578 for T2
                                # Let's just use the first modality as reference for now
                                # I.e. only subjects with all modalities will be included
                        Severity: Minor
                        Found in src/torchio/datasets/ixi.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 download_url has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def download_url(
                            url: str,
                            root: TypePath,
                            filename: Optional[TypePath] = None,
                            md5: Optional[str] = None,
                        Severity: Minor
                        Found in src/torchio/download.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

                        Severity
                        Category
                        Status
                        Source
                        Language