zammad/zammad

View on GitHub
app/assets/javascripts/app/lib/base/cropper.js

Summary

Maintainability
F
2 wks
Test Coverage

File cropper.js has 1820 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Cropper v1.0.0-rc.1
 * https://github.com/fengyuanchen/cropper
 *
 * Copyright (c) 2014-2015 Fengyuan Chen and contributors
Severity: Major
Found in app/assets/javascripts/app/lib/base/cropper.js - About 4 days to fix

    Function change has 331 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        change: function (shiftKey, originalEvent) {
          var options = this.options;
          var aspectRatio = options.aspectRatio;
          var action = this.action;
          var container = this.container;
    Severity: Major
    Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 day to fix

      Function getCroppedCanvas has 88 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          getCroppedCanvas: function (options) {
            var originalWidth;
            var originalHeight;
            var canvasWidth;
            var canvasHeight;
      Severity: Major
      Found in app/assets/javascripts/app/lib/base/cropper.js - About 3 hrs to fix

        Function limitCanvas has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            limitCanvas: function (size, position) {
              var options = this.options;
              var strict = options.strict;
              var container = this.container;
              var containerWidth = container.width;
        Severity: Major
        Found in app/assets/javascripts/app/lib/base/cropper.js - About 2 hrs to fix

          Function build has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              build: function () {
                var options = this.options;
                var $this = this.$element;
                var $clone = this.$clone;
                var $cropper;
          Severity: Major
          Found in app/assets/javascripts/app/lib/base/cropper.js - About 2 hrs to fix

            Function getSourceCanvas has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function getSourceCanvas(image, data) {
                var canvas = $('<canvas>')[0];
                var context = canvas.getContext('2d');
                var x = 0;
                var y = 0;
            Severity: Major
            Found in app/assets/javascripts/app/lib/base/cropper.js - About 2 hrs to fix

              Function renderCanvas has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  renderCanvas: function (changed) {
                    var options = this.options;
                    var canvas = this.canvas;
                    var image = this.image;
                    var aspectRatio;
              Severity: Minor
              Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                Function limitCropBox has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    limitCropBox: function (size, position) {
                      var options = this.options;
                      var strict = options.strict;
                      var container = this.container;
                      var containerWidth = container.width;
                Severity: Minor
                Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                  Function cropStart has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      cropStart: function (event) {
                        var options = this.options;
                        var originalEvent = event.originalEvent;
                        var touches = originalEvent && originalEvent.touches;
                        var e = event;
                  Severity: Minor
                  Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                    Function preview has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        preview: function () {
                          var image = this.image;
                          var canvas = this.canvas;
                          var cropBox = this.cropBox;
                          var width = image.width;
                    Severity: Minor
                    Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                      Function getData has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          getData: function (rounded) {
                            var options = this.options;
                            var image = this.image;
                            var canvas = this.canvas;
                            var cropBox = this.cropBox;
                      Severity: Minor
                      Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                        Function cropMove has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            cropMove: function (event) {
                              var options = this.options;
                              var originalEvent = event.originalEvent;
                              var touches = originalEvent && originalEvent.touches;
                              var e = event;
                        Severity: Minor
                        Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                          Function load has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              load: function (url) {
                                var options = this.options;
                                var $this = this.$element;
                                var crossOrigin = '';
                                var bustCacheUrl;
                          Severity: Minor
                          Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                            Function renderImage has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                renderImage: function (changed) {
                                  var canvas = this.canvas;
                                  var image = this.image;
                                  var reversed;
                            
                            
                            Severity: Minor
                            Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                              Function bind has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  bind: function () {
                                    var options = this.options;
                                    var $this = this.$element;
                                    var $cropper = this.$cropper;
                              
                              
                              Severity: Minor
                              Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                                Function setCropBoxData has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    setCropBoxData: function (data) {
                                      var cropBox = this.cropBox;
                                      var aspectRatio = this.options.aspectRatio;
                                      var widthChanged;
                                      var heightChanged;
                                Severity: Minor
                                Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                                  Function renderCropBox has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      renderCropBox: function () {
                                        var options = this.options;
                                        var container = this.container;
                                        var containerWidth = container.width;
                                        var containerHeight = container.height;
                                  Severity: Minor
                                  Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                                    Function unbind has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        unbind: function () {
                                          var options = this.options;
                                          var $this = this.$element;
                                          var $cropper = this.$cropper;
                                    
                                    
                                    Severity: Minor
                                    Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                                      Function setData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          setData: function (data) {
                                            var image = this.image;
                                            var canvas = this.canvas;
                                            var cropBoxData = {};
                                            var ratio;
                                      Severity: Minor
                                      Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 hr to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                  if (cropped) {
                                                    minCanvasWidth = cropBox.width;
                                                    minCanvasHeight = cropBox.height;
                                        
                                                    if (minCanvasHeight * aspectRatio > minCanvasWidth) {
                                        Severity: Major
                                        Found in app/assets/javascripts/app/lib/base/cropper.js - About 45 mins to fix

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

                                              move: function (offsetX, offsetY) {
                                                var canvas = this.canvas;
                                          
                                                // If "offsetY" is not present, its default value is "offsetX"
                                                if (isUndefined(offsetY)) {
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 6 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1876..1892

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

                                          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

                                              scale: function (scaleX, scaleY) {
                                                var image = this.image;
                                          
                                                // If "scaleY" is not present, its default value is "scaleX"
                                                if (isUndefined(scaleY)) {
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 6 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1794..1810

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

                                          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

                                                  case ACTION_WEST:
                                                    if (range.x <= 0 && (left <= minLeft || aspectRatio &&
                                                      (top <= minTop || bottom >= maxHeight))) {
                                          
                                                      renderable = false;
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 5 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1335..1356

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

                                          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

                                                  case ACTION_NORTH:
                                                    if (range.y <= 0 && (top <= minTop || aspectRatio &&
                                                      (left <= minLeft || right >= maxWidth))) {
                                          
                                                      renderable = false;
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 5 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1358..1379

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

                                          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

                                                  case ACTION_EAST:
                                                    if (range.x >= 0 && (right >= maxWidth || aspectRatio &&
                                                      (top <= minTop || bottom >= maxHeight))) {
                                          
                                                      renderable = false;
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 4 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1381..1401

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

                                          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

                                                  case ACTION_SOUTH:
                                                    if (range.y >= 0 && (bottom >= maxHeight || aspectRatio &&
                                                      (left <= minLeft || right >= maxWidth))) {
                                          
                                                      renderable = false;
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 4 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1313..1333

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

                                          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

                                                      if (range.x <= 0) {
                                                        if (left > minLeft) {
                                                          width -= range.x;
                                                          left += range.x;
                                                        } else if (range.y >= 0 && bottom >= maxHeight) {
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 3 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1461..1471

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

                                          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

                                                      if (range.x <= 0) {
                                                        if (left > minLeft) {
                                                          width -= range.x;
                                                          left += range.x;
                                                        } else if (range.y <= 0 && top <= minTop) {
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 3 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1509..1519

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

                                          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 4 locations. Consider refactoring.
                                          Open

                                                    if (width < 0 && height < 0) {
                                                      action = ACTION_SOUTH_WEST;
                                                      height = 0;
                                                      width = 0;
                                                    } else if (width < 0) {
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 3 other locations - About 2 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1484..1494
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1530..1540
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1573..1583

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

                                          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 4 locations. Consider refactoring.
                                          Open

                                                    if (width < 0 && height < 0) {
                                                      action = ACTION_SOUTH_EAST;
                                                      height = 0;
                                                      width = 0;
                                                    } else if (width < 0) {
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 3 other locations - About 2 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1435..1445
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1530..1540
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1573..1583

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

                                          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 4 locations. Consider refactoring.
                                          Open

                                                    if (width < 0 && height < 0) {
                                                      action = ACTION_NORTH_WEST;
                                                      height = 0;
                                                      width = 0;
                                                    } else if (width < 0) {
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 3 other locations - About 2 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1435..1445
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1484..1494
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1530..1540

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

                                          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 4 locations. Consider refactoring.
                                          Open

                                                    if (width < 0 && height < 0) {
                                                      action = ACTION_NORTH_EAST;
                                                      height = 0;
                                                      width = 0;
                                                    } else if (width < 0) {
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 3 other locations - About 2 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1435..1445
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1484..1494
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1573..1583

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

                                          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

                                                  if (srcWidth <= 0 || srcY <= -originalHeight || srcY > sourceHeight) {
                                                    srcY = srcHeight = dstY = dstHeight = 0;
                                                  } else if (srcY <= 0) {
                                                    dstY = -srcY;
                                                    srcY = 0;
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 2 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 2208..2217

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

                                          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

                                                  if (srcX <= -originalWidth || srcX > sourceWidth) {
                                                    srcX = srcWidth = dstX = dstWidth = 0;
                                                  } else if (srcX <= 0) {
                                                    dstX = -srcX;
                                                    srcX = 0;
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 2 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 2219..2228

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

                                          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

                                                      if (range.x >= 0) {
                                                        if (right < maxWidth) {
                                                          width += range.x;
                                                        } else if (range.y <= 0 && top <= minTop) {
                                                          renderable = false;
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 2 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1554..1562

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

                                          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

                                                      if (range.x >= 0) {
                                                        if (right < maxWidth) {
                                                          width += range.x;
                                                        } else if (range.y >= 0 && bottom >= maxHeight) {
                                                          renderable = false;
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 2 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1414..1422

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

                                          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

                                                    if (aspectRatio) {
                                                      if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {
                                                        renderable = false;
                                                        break;
                                                      }
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 2 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1499..1528

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

                                          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

                                                    if (aspectRatio) {
                                                      if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {
                                                        renderable = false;
                                                        break;
                                                      }
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 2 hrs to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1404..1433

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

                                          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 (range.y <= 0) {
                                                        if (top > minTop) {
                                                          height -= range.y;
                                                          top += range.y;
                                                        }
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 1 hr to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1473..1481

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

                                          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 (range.y <= 0) {
                                                        if (top > minTop) {
                                                          height -= range.y;
                                                          top += range.y;
                                                        }
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 1 hr to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1424..1432

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

                                          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

                                                  if (isNumber(data.width) && data.width !== cropBox.width) {
                                                    widthChanged = true;
                                                    cropBox.width = data.width;
                                                  }
                                          Severity: Minor
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 55 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 2114..2117

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

                                          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

                                                  if (isNumber(data.height) && data.height !== cropBox.height) {
                                                    heightChanged = true;
                                                    cropBox.height = data.height;
                                                  }
                                          Severity: Minor
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 55 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 2109..2112

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

                                          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 (range.y >= 0) {
                                                        if (bottom < maxHeight) {
                                                          height += range.y;
                                                        }
                                                      } else {
                                          Severity: Minor
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 50 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1564..1570

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

                                          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

                                                this.$canvas.css({
                                                  width: canvas.width,
                                                  height: canvas.height,
                                                  left: canvas.left,
                                                  top: canvas.top
                                          Severity: Minor
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 50 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 865..870

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

                                          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 (range.y >= 0) {
                                                        if (bottom < maxHeight) {
                                                          height += range.y;
                                                        }
                                                      } else {
                                          Severity: Minor
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 50 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1521..1527

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

                                          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

                                                this.$cropBox.css({
                                                  width: cropBox.width,
                                                  height: cropBox.height,
                                                  left: cropBox.left,
                                                  top: cropBox.top
                                          Severity: Minor
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 50 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 691..696

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

                                          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 4 locations. Consider refactoring.
                                          Open

                                                if (canvas.width > canvas.maxWidth || canvas.width < canvas.minWidth) {
                                                  canvas.left = canvas.oldLeft;
                                                }
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 3 other locations - About 45 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 679..681
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 843..845
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 847..849

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

                                          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 4 locations. Consider refactoring.
                                          Open

                                                if (cropBox.height > cropBox.maxHeight || cropBox.height < cropBox.minHeight) {
                                                  cropBox.top = cropBox.oldTop;
                                                }
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 3 other locations - About 45 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 675..677
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 679..681
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 843..845

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

                                          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 4 locations. Consider refactoring.
                                          Open

                                                if (canvas.height > canvas.maxHeight || canvas.height < canvas.minHeight) {
                                                  canvas.top = canvas.oldTop;
                                                }
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 3 other locations - About 45 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 675..677
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 843..845
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 847..849

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

                                          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 4 locations. Consider refactoring.
                                          Open

                                                if (cropBox.width > cropBox.maxWidth || cropBox.width < cropBox.minWidth) {
                                                  cropBox.left = cropBox.oldLeft;
                                                }
                                          Severity: Major
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 3 other locations - About 45 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 675..677
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 679..681
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 847..849

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

                                          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

                                              disable: function () {
                                                if (this.built) {
                                                  this.disabled = true;
                                                  this.$cropper.addClass(CLASS_DISABLED);
                                                }
                                          Severity: Minor
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 40 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1751..1756

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

                                          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

                                              enable: function () {
                                                if (this.built) {
                                                  this.disabled = false;
                                                  this.$cropper.removeClass(CLASS_DISABLED);
                                                }
                                          Severity: Minor
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 40 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 1759..1764

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

                                          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

                                                if (this.built) {
                                                  data = {
                                                    left: canvas.left,
                                                    top: canvas.top,
                                                    width: canvas.width,
                                          Severity: Minor
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 40 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 2072..2079

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

                                          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

                                                if (this.built && this.cropped) {
                                                  data = {
                                                    left: cropBox.left,
                                                    top: cropBox.top,
                                                    width: cropBox.width,
                                          Severity: Minor
                                          Found in app/assets/javascripts/app/lib/base/cropper.js and 1 other location - About 40 mins to fix
                                          app/assets/javascripts/app/lib/base/cropper.js on lines 2017..2024

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

                                          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