ThibaultMontaufray/Droid-Image

View on GitHub
Project/Droid.Image.Comparison/ExtensionMethods.cs

Summary

Maintainability
B
5 hrs
Test Coverage

Method BhattacharyyaDifference has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public static float BhattacharyyaDifference(this System.Drawing.Bitmap img1, System.Drawing.Bitmap img2)
        {
            byte[,] img1GrayscaleValues = img1.GetGrayScaleValues();
            byte[,] img2GrayscaleValues = img2.GetGrayScaleValues();

Severity: Minor
Found in Project/Droid.Image.Comparison/ExtensionMethods.cs - About 1 hr to fix

    Method GetDifferenceImage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public static Bitmap GetDifferenceImage(this System.Drawing.Bitmap img1, System.Drawing.Bitmap img2, bool adjustColorSchemeToMaxDifferenceFound = false, bool absoluteText = false)
            {
                //create a 16x16 tiles image with information about how much the two images differ
                int cellsize = 16;  //each tile is 16 pixels wide and high
                Bitmap bmp = new Bitmap(16 * cellsize + 1, 16 * cellsize + 1); //16 blocks * 16 pixels + a borderpixel at left/bottom
    Severity: Minor
    Found in Project/Droid.Image.Comparison/ExtensionMethods.cs - About 1 hr to fix

      Method DrawDifferencesToBitmap has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              private static void DrawDifferencesToBitmap(bool absoluteText, int cellsize, Graphics g, byte[,] differences, byte maxDifference)
      Severity: Minor
      Found in Project/Droid.Image.Comparison/ExtensionMethods.cs - About 35 mins to fix

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

                    for (int x = 0; x < img1GrayscaleValues.GetLength(0); x++)
                    {
                        for (int y = 0; y < img1GrayscaleValues.GetLength(1); y++)
                        {
                            normalizedHistogram1[x, y] = (double)img1GrayscaleValues[x, y] / histSum1;
        Severity: Major
        Found in Project/Droid.Image.Comparison/ExtensionMethods.cs and 1 other location - About 1 hr to fix
        Project/Droid.Image.Comparison/ExtensionMethods.cs on lines 89..95

        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 90.

        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

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

                    for (int x = 0; x < img2GrayscaleValues.GetLength(0); x++)
                    {
                        for (int y = 0; y < img2GrayscaleValues.GetLength(1); y++)
                        {
                            normalizedHistogram2[x, y] = (double)img2GrayscaleValues[x, y] / histSum2;
        Severity: Major
        Found in Project/Droid.Image.Comparison/ExtensionMethods.cs and 1 other location - About 1 hr to fix
        Project/Droid.Image.Comparison/ExtensionMethods.cs on lines 82..88

        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 90.

        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

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

                        g.DrawImage(original, new Rectangle(0, 0, original.Width, original.Height),
                           0, 0, original.Width, original.Height, GraphicsUnit.Pixel, attributes);
        Severity: Minor
        Found in Project/Droid.Image.Comparison/ExtensionMethods.cs and 1 other location - About 35 mins to fix
        Project/Droid.Image/Controler/ColorMatrix.cs on lines 48..52

        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 65.

        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

        There are no issues that match your filters.

        Category
        Status