cgddrd/CS39440-major-project

View on GitHub

Showing 182 of 182 total issues

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    @staticmethod
    def calc_template_match_compare_cv2_score(image_1, image_2, match_method):
        """
        Performs appearance-based matching between two images utilising the OpenCV 'matchTemplate' function.

Severity: Major
Found in src/tse/tse/tse_imageutils.py and 1 other location - About 4 hrs to fix
final/technical_work/primary_experiments/python/tse/tse/tse_imageutils.py on lines 300..323

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 77.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    @staticmethod
    def calc_template_match_compare_cv2_score(image_1, image_2, match_method):
        """
        Performs appearance-based matching between two images utilising the OpenCV 'matchTemplate' function.

src/tse/tse/tse_imageutils.py on lines 300..323

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 77.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      def calc_farneback_flow(image1, image2):
      
          image1_gray = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
          image2_gray = cv2.cvtColor(image2, cv2.COLOR_BGR2GRAY)
      
      
      Severity: Major
      Found in src/feature_tracking_motion_displacement/main.py and 1 other location - About 3 hrs to fix
      final/technical_work/additional_work/python/feature_tracking_motion_displacement/test_features.py on lines 59..66

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 69.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      def calc_farneback_flow(image1, image2):
      
          image1_gray = cv2.cvtColor(image1, cv2.COLOR_BGR2GRAY)
          image2_gray = cv2.cvtColor(image2, cv2.COLOR_BGR2GRAY)
      
      
      src/feature_tracking_motion_displacement/main.py on lines 63..70

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 69.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          @staticmethod
          def scale_image_interpolation_man(source_image, scale_factor):
              """
              Scales the original image by INTERPOLATING between original pixels. Utilises OpenCV 'resize' function.
      
      
      src/tse/tse/tse_imageutils.py on lines 509..523

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 66.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          @staticmethod
          def scale_image_interpolation_man(source_image, scale_factor):
              """
              Scales the original image by INTERPOLATING between original pixels. Utilises OpenCV 'resize' function.
      
      
      Severity: Major
      Found in src/tse/tse/tse_imageutils.py and 1 other location - About 3 hrs to fix
      final/technical_work/primary_experiments/python/tse/tse/tse_imageutils.py on lines 509..523

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 66.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          @staticmethod
          def calc_scaled_image_pixel_dimension_coordinates(image_dim_end, scale_factor, image_dim_start=0, round=True):
              """
              Scales a range of pixel dimension coordinates (i.e. all X coordinates OR Y-coordinates) by a scaling factor.
      
      
      src/tse/tse/tse_imageutils.py on lines 238..259

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 62.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          @staticmethod
          def calc_scaled_image_pixel_dimension_coordinates(image_dim_end, scale_factor, image_dim_start=0, round=True):
              """
              Scales a range of pixel dimension coordinates (i.e. all X coordinates OR Y-coordinates) by a scaling factor.
      
      
      Severity: Major
      Found in src/tse/tse/tse_imageutils.py and 1 other location - About 3 hrs to fix
      final/technical_work/primary_experiments/python/tse/tse/tse_imageutils.py on lines 238..259

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 62.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                  if (plot_count % column_max) != 0:
      
                      if row_max > 1:
      
                          axes[-1, -1].axis('off')
      src/template_matching_scaling/main.py on lines 125..133

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 60.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                  if (plot_count % column_max) != 0:
      
                      if row_max > 1:
      
                          axes[-1, -1].axis('off')
      Severity: Major
      Found in src/template_matching_scaling/main.py and 1 other location - About 2 hrs to fix
      final/technical_work/primary_experiments/python/template_matching_scaling/main.py on lines 125..133

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 60.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      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

      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

      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/)
          
          """
          
          
            Severity
            Category
            Status
            Source
            Language