susantabiswas/FaceRecog

View on GitHub

Showing 11 of 11 total issues

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

    def recognize_face_video(
        self,
        video_path: str = None,
        detection_interval: int = 15,
        save_output: bool = False,
Severity: Minor
Found in video_main.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 register_face_webcam has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def register_face_webcam(
        self, name: str = None, detection_interval: int = 5
    ) -> bool:
        if name is None:
            raise NoNameProvided
Severity: Minor
Found in video_main.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 recognize_faces has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def recognize_faces(
        self, image, threshold: float = 0.6, bboxes: List[List[int]] = None
    ):
        """Finds matching registered users for the
        face(s) in the input image. The input image should be cropped to contain
Severity: Minor
Found in face_recog/face_recognition.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 detect_faces has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def detect_faces(self, image, conf_threshold: float = 0.7) -> List[List[int]]:
        """Performs facial detection on an image. Uses OpenCV DNN based face detector.
        Args:
            image (numpy array):
            conf_threshold (float, optional): Threshold confidence to consider
Severity: Minor
Found in face_recog/face_detection_opencv.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 recognize_face_video has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def recognize_face_video(
Severity: Major
Found in video_main.py - About 50 mins to fix

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

        def delete_data(self, face_id: str) -> bool:
            """Deletes the facial record that match the facial
            Id from persistent DB.
    
            Args:
    Severity: Minor
    Found in face_recog/json_persistent_storage.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 detect_faces has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def detect_faces(self, image, conf_threshold: float = 0.7) -> List[List[int]]:
            """Performs facial detection on an image. Uses MTCNN.
            Args:
                image (numpy array):
                conf_threshold (float, optional): Threshold confidence to consider
    Severity: Minor
    Found in face_recog/face_detection_mtcnn.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 register_face has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def register_face(self, image=None, name: str = None, bbox: List[int] = None):
            """Method to register a face via the facial encoding.
            Siamese neural network is used to generate 128 numbers
            for a given facial region. These encodings can be used to identify a
            facial ROI for identification later.
    Severity: Minor
    Found in face_recog/face_recognition.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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, data: List[Dict] = None):
            """Constructor
    
            Args:
                data (List[Dict], optional): Initial data to load in the cache.
    Severity: Minor
    Found in face_recog/simple_cache.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 is_valid_bbox has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def is_valid_bbox(self, bbox: List[int], height: int, width: int) -> bool:
            """Checks if the bounding box exists in the image.
    
            Args:
                bbox (List[int]): Bounding box coordinates
    Severity: Minor
    Found in face_recog/face_detection_opencv.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

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

        def delete_data(self, face_id: str):
            """Deletes the facial record that match the facial
            Id from cache.
    
            Args:
    Severity: Minor
    Found in face_recog/simple_cache.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