sjoerdk/dicomtrolley

View on GitHub

Showing 16 of 16 total issues

File core.py has 603 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Provides common base classes that allow modules to talk to each other."""
from dataclasses import dataclass
from datetime import date, datetime
from enum import Enum, IntEnum
from itertools import chain
Severity: Major
Found in dicomtrolley/core.py - About 1 day to fix

    File qido_rs.py has 340 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """Models QIDO-RS: Query based on ID for dicom Objects by Restful Services.
    
    
    See: [QIDO-RS reference](https://www.dicomstandard.org/using/dicomweb/query-qido-rs/)
    and [QIDO-RS at NEMA]
    Severity: Minor
    Found in dicomtrolley/qido_rs.py - About 4 hrs to fix

      File rad69.py has 325 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """Retrieve data from servers using the rad69 protocol
      
      see [rad69 document set]
      (https://gazelle.ihe.net/content/rad-69-retrieve-imaging-document-set)
      And the corresponding [transaction]
      Severity: Minor
      Found in dicomtrolley/rad69.py - About 3 hrs to fix

        File datastructures.py has 311 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """Additional datastructures that do not belong to any specific dicomtrolley
        class or function
        
        """
        from datetime import datetime
        Severity: Minor
        Found in dicomtrolley/datastructures.py - About 3 hrs to fix

          Function prune_all has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

              def prune_all(  # noqa: C901  # not too complex I think. Just elifs
                  self,
                  addresses: List[TreeAddress],
                  strategy: PruneStrategy = PruneStrategy.WHERE_POSSIBLE,
              ):
          Severity: Minor
          Found in dicomtrolley/datastructures.py - About 2 hrs 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

          File mint.py has 267 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          """Models the MINT DICOM exchange protocol
          See:
          https://code.google.com/archive/p/medical-imaging-network-transport/downloads
          """
          from typing import ClassVar, List, Sequence, Set
          Severity: Minor
          Found in dicomtrolley/mint.py - About 2 hrs to fix

            File caching.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """Storing DICOM query results locally to avoid unneeded calls to server"""
            
            from typing import Dict, Iterable, List, Optional, Sequence, Tuple
            
            from dicomtrolley.core import (
            Severity: Minor
            Found in dicomtrolley/caching.py - About 2 hrs to fix

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

                  def send_c_find(self, query):
                      """Perform a CFIND with the given query
              
                      Raises
                      ------
              Severity: Minor
              Found in dicomtrolley/dicom_qr.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_dicom_qr_trolley has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def get_dicom_qr_trolley(
              Severity: Major
              Found in dicomtrolley/servers.py - About 50 mins to fix

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

                    def get_mint_trolley(
                Severity: Minor
                Found in dicomtrolley/servers.py - About 35 mins to fix

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

                      def __init__(
                  Severity: Minor
                  Found in dicomtrolley/dicom_qr.py - About 35 mins to fix

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

                        def __init__(
                    Severity: Minor
                    Found in dicomtrolley/rad69.py - About 35 mins to fix

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

                          def __next__(self):
                              sized_chunk = bytearray()
                              while len(sized_chunk) < self.chunk_size:
                                  try:
                                      sized_chunk += next(self._chunk_iterator)
                      Severity: Minor
                      Found in dicomtrolley/http.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 prune_leaf has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def prune_leaf(self, address: TreeAddress):
                              """Prune node at this address only if it has no children
                      
                              Raises
                              ------
                      Severity: Minor
                      Found in dicomtrolley/datastructures.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

                      Avoid too many return statements within this function.
                      Open

                                  return part
                      Severity: Major
                      Found in dicomtrolley/http.py - About 30 mins to fix

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

                            def __init__(
                                self,
                                initial_objects: Optional[List[DICOMObject]] = None,
                                expiry_seconds: Optional[int] = 600,
                            ):
                        Severity: Minor
                        Found in dicomtrolley/caching.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