CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js

Summary

Maintainability
F
3 days
Test Coverage

File image-edit.dev.js has 454 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var imageEdit;

(function($) {
imageEdit = {
    iasapi : {},
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js - About 6 hrs to fix

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

        filterHistory : function(postid, setSize) {
            // apply undo state to history
            var history = $('#imgedit-history-' + postid).val(), pop, n, o, i, op = [];
    
            if ( history != '' ) {
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js - About 1 hr to fix

      Function action has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          action : function(postid, nonce, action) {
              var t = this, data, w, h, fw, fh;
      
              if ( t.notsaved(postid) )
                  return false;
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js - About 1 hr to fix

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

            initCrop : function(postid, image, parent) {
                var t = this, selW = $('#imgedit-sel-width-' + postid),
                    selH = $('#imgedit-sel-height-' + postid);
        
                t.iasapi = $(image).imgAreaSelect({
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js - About 1 hr to fix

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

              setNumSelection : function(postid) {
                  var sel, elX = $('#imgedit-sel-width-' + postid), elY = $('#imgedit-sel-height-' + postid),
                      x = this.intval( elX.val() ), y = this.intval( elY.val() ),
                      img = $('#image-preview-' + postid), imgh = img.height(), imgw = img.width(),
                      sizer = this.hold['sizer'], x1, y1, x2, y2, ias = this.iasapi;
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js - About 1 hr to fix

            Function save has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                save : function(postid, nonce) {
                    var data, target = this.getTarget(postid), history = this.filterHistory(postid, 0);
            
                    if ( '' == history )
                        return false;
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js - About 1 hr to fix

              Function refreshEditor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  refreshEditor : function(postid, nonce, callback) {
                      var t = this, data, img;
              
                      t.toggleEditor(postid, 1);
                      data = {
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js - About 1 hr to fix

                Avoid too many return statements within this function.
                Open

                            return false;
                Severity: Major
                Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js - About 30 mins to fix

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

                      flip : function (axis, postid, nonce, t) {
                          if ( $(t).hasClass('disabled') )
                              return false;
                  
                          this.addStep({ 'f': { 'f': axis, 'fw': this.hold['w'], 'fh': this.hold['h'] }}, postid, nonce);
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js and 1 other location - About 2 hrs to fix
                  Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js on lines 419..424

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

                  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

                      rotate : function(angle, postid, nonce, t) {
                          if ( $(t).hasClass('disabled') )
                              return false;
                  
                          this.addStep({ 'r': { 'r': angle, 'fw': this.hold['h'], 'fh': this.hold['w'] }}, postid, nonce);
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js and 1 other location - About 2 hrs to fix
                  Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js on lines 426..431

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

                  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 ( x ) {
                              h1 = (w.val() != '') ? this.intval( w.val() / this.hold['xy_ratio'] ) : '';
                              h.val( h1 );
                          } else {
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js and 1 other location - About 1 hr to fix
                  Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js on lines 77..80

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 65.

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

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

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

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

                  Refactorings

                  Further Reading

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

                          } else {
                              w1 = (h.val() != '') ? this.intval( h.val() * this.hold['xy_ratio'] ) : '';
                              w.val( w1 );
                          }
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js and 1 other location - About 1 hr to fix
                  Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js on lines 74..77

                  Duplicated Code

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

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

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

                  Tuning

                  This issue has a mass of 65.

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

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

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

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

                  Refactorings

                  Further Reading

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

                          var t = this, button = $('#image-redo-' + postid), elem = $('#imgedit-undone-' + postid),
                              pop = t.intval( elem.val() ) - 1;
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js and 1 other location - About 1 hr to fix
                  Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js on lines 450..451

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

                  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

                          var t = this, button = $('#image-undo-' + postid), elem = $('#imgedit-undone-' + postid),
                              pop = t.intval( elem.val() ) + 1;
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js and 1 other location - About 1 hr to fix
                  Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js on lines 467..468

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

                  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 ( x2 > imgw ) {
                                  x1 = 0;
                                  x2 = imgw;
                                  elX.val( Math.round( x2 / sizer ) );
                              }
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js and 1 other location - About 40 mins to fix
                  Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js on lines 508..512

                  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 ( y2 > imgh ) {
                                  y1 = 0;
                                  y2 = imgh;
                                  elY.val( Math.round( y2 / sizer ) );
                              }
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js and 1 other location - About 40 mins to fix
                  Web.Admin/2014/wordpress/wp-admin/js/image-edit.dev.js on lines 502..506

                  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