CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js

Summary

Maintainability
F
1 wk
Test Coverage

Function imgAreaSelect has 482 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.imgAreaSelect = function (img, options) {
    var

        $img = $(img),

    File jquery.imgareaselect.dev.js has 508 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * imgAreaSelect jQuery plugin
     * version 0.9.1
     *
     * Copyright (c) 2008-2009 Michal Wojciechowski (odyniec.net)

      Function setOptions has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function setOptions(newOptions) {
              if (newOptions.parent)
                  ($parent = $(newOptions.parent)).append($box.add($outer));
      
              options = $.extend(options, newOptions);

        Function docKeyPress has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var docKeyPress = function(event) {
                var k = options.keys, d, t, key = event.keyCode || event.which;
        
                d = !isNaN(k.alt) && (event.altKey || event.originalEvent.altKey) ? k.alt :
                    !isNaN(k.ctrl) && event.ctrlKey ? k.ctrl :

          Function update has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function update(resetKeyPress) {
                  if (!shown) return;
          
                  $box.css({ left: viewX(selection.x1), top: viewY(selection.y1) })
                      .add($area).width(w = selection.width).height(h = selection.height);

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

                function doResize() {
                    if (abs(x2 - x1) < options.minWidth) {
                        x2 = x1 - options.minWidth * (x2 < x1 || -1);
            
                        if (x2 < left)

              Consider simplifying this complex logical expression.
              Open

                      if (k.arrows == 'resize' || (k.shift == 'resize' && event.shiftKey) ||
                          (k.ctrl == 'resize' && event.ctrlKey) ||
                          (k.alt == 'resize' && (event.altKey || event.originalEvent.altKey)))
                      {
                          switch (key) {

                Function setSelection has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    function setSelection(x1, y1, x2, y2, noScale) {

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

                      function aspectRatioXY() {
                          x2 = max(left, min(left + imgWidth,
                              x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1)));
                  
                          y2 = round(max(top, min(top + imgHeight,
                  Web.Admin/2014/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js on lines 296..302

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

                  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

                      function aspectRatioYX() {
                          y2 = max(top, min(top + imgHeight,
                              y1 + abs(x2 - x1) / aspectRatio * (y2 > y1 || -1)));
                          x2 = round(max(left, min(left + imgWidth,
                              x1 + abs(y2 - y1) * aspectRatio * (x2 > x1 || -1))));
                  Web.Admin/2014/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js on lines 287..294

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

                  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 (abs(y2 - y1) < options.minHeight) {
                              y2 = y1 - options.minHeight * (y2 < y1 || -1);
                  
                              if (y2 < top)
                                  y1 = top + options.minHeight;
                  Web.Admin/2014/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js on lines 305..312

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

                  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 (abs(x2 - x1) < options.minWidth) {
                              x2 = x1 - options.minWidth * (x2 < x1 || -1);
                  
                              if (x2 < left)
                                  x1 = left + options.minWidth;
                  Web.Admin/2014/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js on lines 314..321

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

                  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 (abs(x2 - x1) > options.maxWidth) {
                              x2 = x1 - options.maxWidth * (x2 < x1 || -1);
                              if (aspectRatio) aspectRatioYX();
                          }
                  Web.Admin/2014/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js on lines 337..340

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 62.

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

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

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

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

                  Refactorings

                  Further Reading

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

                          if (abs(y2 - y1) > options.maxHeight) {
                              y2 = y1 - options.maxHeight * (y2 < y1 || -1);
                              if (aspectRatio) aspectRatioXY();
                          }
                  Web.Admin/2014/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js on lines 332..335

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 62.

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

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

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

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

                  Refactorings

                  Further Reading

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

                              case 39:
                                  t = max(x1, x2);
                                  x1 = min(x1, x2);
                                  x2 = max(t + d, x1);
                                  if (aspectRatio) aspectRatioYX();
                  Web.Admin/2014/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js on lines 483..488

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

                  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 40:
                                  t = max(y1, y2);
                                  y1 = min(y1, y2);
                                  y2 = max(t + d, y1);
                                  if (aspectRatio) aspectRatioXY();
                  Web.Admin/2014/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js on lines 475..480

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

                  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

                          x2 = resize == '' || /w|e/.test(resize) || aspectRatio ? evX(event) : viewX(selection.x2);
                  Web.Admin/2014/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js on lines 353..353

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

                  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

                          y2 = resize == '' || /n|s/.test(resize) || aspectRatio ? evY(event) : viewY(selection.y2);
                  Web.Admin/2014/wordpress/wp-includes/js/imgareaselect/jquery.imgareaselect.dev.js on lines 352..352

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

                  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