CaffGeek/MBACNationals

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

Summary

Maintainability
F
5 days
Test Coverage

File theme.js has 1015 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global _wpThemeSettings, confirm */
window.wp = window.wp || {};

( function($) {

Severity: Major
Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js - About 2 days to fix

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

        preview: function( event ) {
            var self = this,
                current, preview;
    
            // Bail if the user scrolled on a touch device
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js - About 2 hrs to fix

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

          query: function( request ) {
              /**
               * @static
               * @type Array
               */
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js - About 2 hrs to fix

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

            initialize: function( options ) {
                var self = this;
        
                // Set up parent
                this.parent = options.parent;
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js - About 1 hr to fix

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

              render: function() {
                  var self = this;
          
                  this.search();
                  this.uploader();
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js - About 1 hr to fix

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

                    $( 'a.browse-themes' ).on( 'click', function( event ) {
                        event.preventDefault();
                        $( 'body' ).removeClass( 'show-upload-theme' );
                        themes.router.navigate( themes.router.baseUrl( '' ), { replace: true } );
                    });
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js and 1 other location - About 2 hrs to fix
            Web.Admin/2014/wordpress/wp-admin/js/theme.js on lines 1502..1506

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

            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

                    $( 'a.upload' ).on( 'click', function( event ) {
                        event.preventDefault();
                        $( 'body' ).addClass( 'show-upload-theme' );
                        themes.router.navigate( themes.router.baseUrl( '?upload' ), { replace: true } );
                    });
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js and 1 other location - About 2 hrs to fix
            Web.Admin/2014/wordpress/wp-admin/js/theme.js on lines 1507..1511

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

            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

                render: function() {
            
                    // Render results
                    this.view.render();
                    this.routes();
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js and 1 other location - About 2 hrs to fix
            Web.Admin/2014/wordpress/wp-admin/js/theme.js on lines 1203..1214

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

            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

                render: function() {
            
                    // Render results
                    this.view.render();
                    this.routes();
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js and 1 other location - About 2 hrs to fix
            Web.Admin/2014/wordpress/wp-admin/js/theme.js on lines 1606..1617

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

            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

                        self.current = self.model.collection.at( self.model.collection.indexOf( current ) + 1 );
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js and 1 other location - About 50 mins to fix
            Web.Admin/2014/wordpress/wp-admin/js/theme.js on lines 541..541

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

            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

                        self.current = self.model.collection.at( self.model.collection.indexOf( current ) - 1 );
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js and 1 other location - About 50 mins to fix
            Web.Admin/2014/wordpress/wp-admin/js/theme.js on lines 506..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 51.

            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

                navigate: function() {
                    if ( Backbone.history._hasPushState ) {
                        Backbone.Router.prototype.navigate.apply( this, arguments );
                    }
                }
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js and 1 other location - About 40 mins to fix
            Web.Admin/2014/wordpress/wp-admin/js/theme.js on lines 1180..1184

            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

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

                navigate: function() {
                    if ( Backbone.history._hasPushState ) {
                        Backbone.Router.prototype.navigate.apply( this, arguments );
                    }
                }
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js and 1 other location - About 40 mins to fix
            Web.Admin/2014/wordpress/wp-admin/js/theme.js on lines 1583..1587

            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 ( previousModel !== undefined ) {
            
                        // We have a new theme...
                        // Close the overlay
                        this.overlay.closeOverlay();
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js and 1 other location - About 30 mins to fix
            Web.Admin/2014/wordpress/wp-admin/js/theme.js on lines 1044..1053

            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

                    if ( nextModel !== undefined ) {
            
                        // We have a new theme...
                        // Close the overlay
                        this.overlay.closeOverlay();
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/js/theme.js and 1 other location - About 30 mins to fix
            Web.Admin/2014/wordpress/wp-admin/js/theme.js on lines 1068..1077

            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