CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/js/revisions.js

Summary

Maintainability
F
3 days
Test Coverage

File revisions.js has 818 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global _wpRevisionsSettings, isRtl */
window.wp = window.wp || {};

(function($) {
    var revisions;
Severity: Major
Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js - About 1 day to fix

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

            ensure: function( id, context ) {
                var diff     = this.get( id ),
                    request  = this.requests[ id ],
                    deferred = $.Deferred(),
                    ids      = {},
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js - About 1 hr to fix

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

              start: function( event, ui ) {
                  this.model.set({ scrubbing: true });
      
                  // Track the mouse position to enable smooth dragging,
                  // overrides default jQuery UI step behavior.
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js - About 1 hr to fix

        Function initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                initialize: function() {
                    _.bindAll( this, 'setWidth' );
        
                    // Add the button view
                    this.views.add( new revisions.view.Buttons({
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js - About 1 hr to fix

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

                  slide: function( event, ui ) {
                      var attributes, movedRevision;
                      // Compare two revisions mode
                      if ( this.model.get('compareTwoMode') ) {
                          // Prevent sliders from occupying same spot
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js - About 1 hr to fix

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

                    ready: function() {
                        this.top = this.$el.offset().top;
                        this.window = $(window);
                        this.window.on( 'scroll.wp.revisions', {controls: this}, function(e) {
                            var controls  = e.data.controls,
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js - About 1 hr to fix

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

                      return _.extend( offset, {
                          right:  win.width()  - offset.left - this.outerWidth(),
                          bottom: win.height() - offset.top  - this.outerHeight()
                      });
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js and 1 other location - About 2 hrs to fix
              Web.Admin/2014/wordpress/wp-admin/js/revisions.js on lines 32..35

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

              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

                      return _.extend( position, {
                          right:  parent.outerWidth()  - position.left - this.outerWidth(),
                          bottom: parent.outerHeight() - position.top  - this.outerHeight()
                      });
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js and 1 other location - About 2 hrs to fix
              Web.Admin/2014/wordpress/wp-admin/js/revisions.js on lines 24..27

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

              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

                      initialize: function() {
                          this.listenTo( this.model, 'change:offset', this.render );
                          this.listenTo( this.model, 'change:hovering', this.toggleVisibility );
                          this.listenTo( this.model, 'change:scrubbing', this.toggleVisibility );
                      },
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js and 1 other location - About 1 hr to fix
              Web.Admin/2014/wordpress/wp-includes/js/media-models.js on lines 382..386

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

              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

                      previousRevision: function() {
                          var toIndex = this.model.revisions.indexOf( this.model.get('to') ) - 1;
                          this.gotoModel( toIndex );
                      },
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js and 1 other location - About 1 hr to fix
              Web.Admin/2014/wordpress/wp-admin/js/revisions.js on lines 848..851

              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

                      nextRevision: function() {
                          var toIndex = this.model.revisions.indexOf( this.model.get('to') ) + 1;
                          this.gotoModel( toIndex );
                      },
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js and 1 other location - About 1 hr to fix
              Web.Admin/2014/wordpress/wp-admin/js/revisions.js on lines 854..857

              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

                  revisions.view.MetaTo = revisions.view.Meta.extend({
                      className: 'diff-meta diff-meta-to',
                      type: 'to'
                  });
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js and 1 other location - About 35 mins to fix
              Web.Admin/2014/wordpress/wp-admin/js/revisions.js on lines 713..716

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

              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

                  revisions.view.MetaFrom = revisions.view.Meta.extend({
                      className: 'diff-meta diff-meta-from',
                      type: 'from'
                  });
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/js/revisions.js and 1 other location - About 35 mins to fix
              Web.Admin/2014/wordpress/wp-admin/js/revisions.js on lines 719..722

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

              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