kyle0x54/medvision

View on GitHub

Showing 27 of 39 total issues

Function eval_det has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

def eval_det(dts, gts, num_classes=1, iou_thr=0.5):
    """ Evaluate a given dataset by comparing DT with GT.

    Args:
        dts (dict or list[list[ndarray]]): detected bounding boxes for
Severity: Minor
Found in medvision/evaluation/eval_det.py - About 3 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

Function imshow_bboxes has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def imshow_bboxes(
    img,
    bboxes,
    score_thr=0,
    colors=Color.green,
Severity: Minor
Found in medvision/visualization/image.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

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

def dsmd2rws_bbox(
    rws_dir,
    dsmd,
    class2label,
    suffix='.json_A1',
Severity: Minor
Found in medvision/annotation/rws2dsmd.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

Function rws2dsmd_bbox has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def rws2dsmd_bbox(
    filepaths,
    class2label,
    suffix='.json',
    num_classes=None
Severity: Minor
Found in medvision/annotation/rws2dsmd.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

Function eval_det4binarycls has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def eval_det4binarycls(dts, gts, score_thrs):
    """ Evaluate a detector's classification capability.

    Only support 1-class detection. If (at least) 1 target is detected in
    an image, the image is considered to be 'positive'. Otherwise, the image
Severity: Minor
Found in medvision/evaluation/eval_det.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

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

def dcmread_dr(
    path: Union[str, Path],
    mode: DrReadMode = DrReadMode.MONOCHROME2,
    read_header: bool = False,
    itk_handler_enabled: bool = True
Severity: Minor
Found in medvision/dicom/dr_io.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 imshow_bboxes has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

def imshow_bboxes(
Severity: Major
Found in medvision/visualization/image.py - About 1 hr to fix

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

    def download_url(
        url: str,
        dst_dir: str,
        *,
        filename: Optional[str] = None,
    Severity: Minor
    Found in medvision/network/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

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

    def save_det_dsmd(
        dsmd_path: Union[str, Path],
        data: Dict[str, List[np.ndarray]],
        class2label: Union[str, Dict[str, int]],
        auto_mkdirs: bool = True
    Severity: Minor
    Found in medvision/dataset/detection.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 shape_to_mask has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def shape_to_mask(img_shape, points, shape_type=None,
                      line_width=10, point_size=5):
        mask = np.zeros(img_shape[:2], dtype=np.uint8)
        mask = PIL.Image.fromarray(mask)
        draw = PIL.ImageDraw.Draw(mask)
    Severity: Minor
    Found in medvision/annotation/rws2mask.py - About 55 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 download_tree has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def download_tree(self, local_dir, remote_dir):
            logging.info('remote_dir, %s', remote_dir)
            if not os.path.exists(local_dir):
                os.makedirs(local_dir)
            self.ftp.cwd(remote_dir)
    Severity: Minor
    Found in medvision/util/ftputil.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 save_rws_bbox has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def save_rws_bbox(
    Severity: Minor
    Found in medvision/annotation/rws.py - About 45 mins to fix

      Function imshow has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def imshow(
      Severity: Minor
      Found in medvision/visualization/image.py - About 45 mins to fix

        Function dsmd2rws_bbox has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def dsmd2rws_bbox(
        Severity: Minor
        Found in medvision/annotation/rws2dsmd.py - About 45 mins to fix

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

          def download_url(
          Severity: Minor
          Found in medvision/network/download.py - About 35 mins to fix

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

            def save_dsmd(dsmd_path, data, class2label=None, auto_mkdirs=True, mode='cls'):
            Severity: Minor
            Found in medvision/dataset/dsmd.py - About 35 mins to fix

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

              def crop(img, i, j, h, w):
              Severity: Minor
              Found in medvision/image/transforms/geometry.py - About 35 mins to fix

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

                def draw_froc_curve(average_fps,
                Severity: Minor
                Found in medvision/visualization/draw_curve.py - About 35 mins to fix

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

                  def shape_to_mask(img_shape, points, shape_type=None,
                  Severity: Minor
                  Found in medvision/annotation/rws2mask.py - About 35 mins to fix

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

                    def load_det_dsmd(
                        dsmd_path: Union[str, Path],
                        class2label: Union[str, Dict[str, int]]
                    ):
                        """ load detection dataset metadata.
                    Severity: Minor
                    Found in medvision/dataset/detection.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

                    Severity
                    Category
                    Status
                    Source
                    Language