cgddrd/CS39440-major-project

View on GitHub

Showing 53 of 182 total issues

Function start_tests has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

def start_tests(image_pairs, patch_sizes, match_methods, config_file, use_scaling=False, scale_centre=True, exhaustive_search=False, use_hsv=True, strip_luminance=True, plot_results=False):
    """
    Executes sequential experiment tests for each possible combination of experiment parameters defined via command line arguments.

    :param image_pairs: Collection of file paths for one or more pairs of images.

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 start_tests has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

def start_tests(image_pairs, patch_sizes, match_methods, config_file, use_scaling=False, scale_centre=True, exhaustive_search=False, use_hsv=True, strip_luminance=True, plot_results=False, demo_mode=False):
    """
    Executes sequential experiment tests for each possible combination of experiment parameters defined via command line arguments.

    :param image_pairs: Collection of file paths for one or more pairs of images.
Severity: Minor
Found in src/template_matching_scaling/main.py - About 6 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 template_matching_roi_scale_centre has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def template_matching_roi_scale_centre(self, template_patch, template_patch_origin, match_method, exhaustive_search=False):
        """
        Performs template matching using either an exhaustive or non-exhaustive search within a localised search column spanning from the current row
        to the bottom of the image. Geometric scaling of the template patch is performed relative to its centre.

Severity: Minor
Found in src/template_matching_scaling/template_matching.py - About 4 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 template_matching_roi_scale_top has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def template_matching_roi_scale_top(self, template_patch, template_patch_origin, match_method, exhaustive_search=False):
        """
        Performs template matching using either an exhaustive or non-exhaustive search within a localised search column spanning from the current row
        to the bottom of the image. Geometric scaling of the template patch is performed relative to its top origin.

Severity: Minor
Found in src/template_matching_scaling/template_matching.py - About 4 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 tse_imageutils.py has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""

Module Name: TSEImageUtils

Description: Provides functionality relating to image processing and template matching.
Severity: Minor
Found in src/tse/tse/tse_imageutils.py - About 4 hrs to fix

    File tse_imageutils.py has 342 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    
    Module Name: TSEImageUtils
    
    Description: Provides functionality relating to image processing and template matching.

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

          def template_matching_roi_scale_top(self, template_patch, template_patch_origin, match_method, exhaustive_search=False):
              """
              Performs template matching using either an exhaustive or non-exhaustive search within a localised search column spanning from the current row
              to the bottom of the image. Geometric scaling of the template patch is performed relative to its top origin.
      
      

      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 template_matching_roi_scale_centre has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def template_matching_roi_scale_centre(self, template_patch, template_patch_origin, match_method, exhaustive_search=False):
              """
              Performs template matching using either an exhaustive or non-exhaustive search within a localised search column spanning from the current row
              to the bottom of the image. Geometric scaling of the template patch is performed relative to its centre.
      
      

      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 template_matching_roi_no_scale has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def template_matching_roi_no_scale(self, template_patch, template_patch_origin, match_method, exhaustive_search=False):
              """
              Performs template matching using either an exhaustive or non-exhaustive search within a localised search column spanning from the current row
              to the bottom of the image. No scaling is performed.
      
      

      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 template_matching_roi_no_scale has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def template_matching_roi_no_scale(self, template_patch, template_patch_origin, match_method, exhaustive_search=False):
              """
              Performs template matching using either an exhaustive or non-exhaustive search within a localised search column spanning from the current row
              to the bottom of the image. No scaling is performed.
      
      
      Severity: Minor
      Found in src/template_matching_scaling/template_matching.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 template_matching.py has 279 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      
      Module Name: TemplateMatching
      
      Description: Performs each template matching experiment based upon the parameters passed in by the test rig.
      Severity: Minor
      Found in src/template_matching_scaling/template_matching.py - About 2 hrs to fix

        File template_matching.py has 268 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """
        
        Module Name: TemplateMatching
        
        Description: Performs each template matching experiment based upon the parameters passed in by the test rig.

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

          """
          Note: This code is heavily based upon the C# implementation developed by Dr Rainer Hessmer (http://www.hessmer.org/blog/2010/08/17/monocular-visual-odometry/comment-page-1/)
          
          """
          
          

            Function calc_lk_patches_flow has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            def calc_lk_patches_flow(image1, image2, feature_params, patch_size, max_val_threshold, use_subpix=False):
            
                count = 0
                raw_results = {}
                half_patch_size = round(patch_size / 2)

            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 calc_lk_patches_flow has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            def calc_lk_patches_flow(image1, image2, feature_params, patch_size, max_val_threshold, use_subpix=False):
            
                count = 0
                raw_results = {}
                half_patch_size = round(patch_size / 2)
            Severity: Minor
            Found in src/feature_tracking_motion_displacement/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 on_key_press has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def on_key_press(self, event):
            
                    if event.key == 'c':
                        self.reset_image_gui()
                        print "Image reset successfully."

            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 on_key_press has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                def on_key_press(self, event):
            
                    if event.key == 'c':
                        self.reset_image_gui()
                        print "Image reset successfully."
            Severity: Minor
            Found in src/perspective_calibration/perspective_calib.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 track_features has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def track_features(self):
            
                    if len(self._raw_tracked_feature_points) == 0:
                        return
            
            
            Severity: Minor
            Found in src/feature_tracking_motion_displacement/visual_odometer.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 track_features has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def track_features(self):
            
                    if len(self._raw_tracked_feature_points) == 0:
                        return
            
            

            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 start_tests has 11 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def start_tests(image_pairs, patch_sizes, match_methods, config_file, use_scaling=False, scale_centre=True, exhaustive_search=False, use_hsv=True, strip_luminance=True, plot_results=False, demo_mode=False):
            Severity: Major
            Found in src/template_matching_scaling/main.py - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language