insideout10/wordlift-plugin-js

View on GitHub
app/admin_files/wp-lists.js

Summary

Maintainability
F
3 days
Test Coverage

File wp-lists.js has 349 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global ajaxurl, wpAjax */
(function($) {
var fs = {add:'ajaxAdd',del:'ajaxDel',dim:'ajaxDim',process:'process',recolor:'recolor'}, wpList;

wpList = {
Severity: Minor
Found in app/admin_files/wp-lists.js - About 4 hrs to fix

    Function ajaxDim has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        ajaxDim: function( e, s ) {
            if ( $(e).parent().css('display') == 'none' ) // Prevent hidden links from being clicked by hotkeys
                return false;
    
            e = $(e);
    Severity: Major
    Found in app/admin_files/wp-lists.js - About 2 hrs to fix

      Function ajaxAdd has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ajaxAdd: function( e, s ) {
              e = $(e);
              s = s || {};
              var list = this, data = wpList.parseData(e,'add'), es, valid, formData, res, rres;
      
      
      Severity: Major
      Found in app/admin_files/wp-lists.js - About 2 hrs to fix

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

            ajaxDel: function( e, s ) {
                e = $(e);
                s = s || {};
                var list = this, data = wpList.parseData(e,'delete'), element, res, rres;
        
        
        Severity: Major
        Found in app/admin_files/wp-lists.js - About 2 hrs to fix

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

              add: function( e, s ) {
                  e = $( $.trim(e) ); // Trim leading whitespaces
          
                  var list = $(this), old = false, _s = { pos: 0, id: 0, oldId: null }, ba, ref, color;
          
          
          Severity: Minor
          Found in app/admin_files/wp-lists.js - About 1 hr to fix

            Avoid too many return statements within this function.
            Open

                            return true;
            Severity: Major
            Found in app/admin_files/wp-lists.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return true;
              Severity: Major
              Found in app/admin_files/wp-lists.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return false;
                Severity: Major
                Found in app/admin_files/wp-lists.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return false;
                  Severity: Major
                  Found in app/admin_files/wp-lists.js - About 30 mins to fix

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

                            s.complete = function(x, st) {
                                if ( $.isFunction(s.dimAfter) ) {
                                    element.queue( function() {
                                        var _s = $.extend( { xml: x, status: st, parsed: res }, s );
                                        s.dimAfter( rres, _s );
                    Severity: Major
                    Found in app/admin_files/wp-lists.js and 1 other location - About 3 hrs to fix
                    app/admin_files/wp-lists.js on lines 205..212

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

                    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

                            s.complete = function(x, st) {
                                if ( $.isFunction(s.delAfter) ) {
                                    element.queue( function() {
                                        var _s = $.extend( { xml: x, status: st, parsed: res }, s );
                                        s.delAfter( rres, _s );
                    Severity: Major
                    Found in app/admin_files/wp-lists.js and 1 other location - About 3 hrs to fix
                    app/admin_files/wp-lists.js on lines 292..299

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

                    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 ( data[5] )
                                s.dimDelColor = '#' + data[5];
                            else
                                s.dimDelColor = s.dimDelColor || '#FF3333';
                    Severity: Major
                    Found in app/admin_files/wp-lists.js and 3 other locations - About 35 mins to fix
                    app/admin_files/wp-lists.js on lines 74..77
                    app/admin_files/wp-lists.js on lines 157..160
                    app/admin_files/wp-lists.js on lines 232..235

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

                    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 ( data[4] )
                                s.dimAddColor = '#' + data[4];
                            else
                                s.dimAddColor = s.dimAddColor || '#FFFF33';
                    Severity: Major
                    Found in app/admin_files/wp-lists.js and 3 other locations - About 35 mins to fix
                    app/admin_files/wp-lists.js on lines 74..77
                    app/admin_files/wp-lists.js on lines 157..160
                    app/admin_files/wp-lists.js on lines 237..240

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

                    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 ( data[3] )
                                s.addColor = '#' + data[3];
                            else
                                s.addColor = s.addColor || '#FFFF33';
                    Severity: Major
                    Found in app/admin_files/wp-lists.js and 3 other locations - About 35 mins to fix
                    app/admin_files/wp-lists.js on lines 157..160
                    app/admin_files/wp-lists.js on lines 232..235
                    app/admin_files/wp-lists.js on lines 237..240

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

                    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 ( data[3] )
                                s.delColor = '#' + data[3];
                            else
                                s.delColor = s.delColor || '#faa';
                    Severity: Major
                    Found in app/admin_files/wp-lists.js and 3 other locations - About 35 mins to fix
                    app/admin_files/wp-lists.js on lines 74..77
                    app/admin_files/wp-lists.js on lines 232..235
                    app/admin_files/wp-lists.js on lines 237..240

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

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

                            $el.delegate( 'form[data-wp-lists^="add:' + list.id + ':"]', 'submit', function(){
                                return list.wpList.add(this);
                            });
                    Severity: Minor
                    Found in app/admin_files/wp-lists.js and 2 other locations - About 30 mins to fix
                    app/admin_files/wp-lists.js on lines 405..407
                    app/admin_files/wp-lists.js on lines 409..411

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

                            $el.delegate( '[data-wp-lists^="delete:' + list.id + ':"]', 'click', function(){
                                return list.wpList.del(this);
                            });
                    Severity: Minor
                    Found in app/admin_files/wp-lists.js and 2 other locations - About 30 mins to fix
                    app/admin_files/wp-lists.js on lines 397..399
                    app/admin_files/wp-lists.js on lines 409..411

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

                            $el.delegate( '[data-wp-lists^="dim:' + list.id + ':"]', 'click', function(){
                                return list.wpList.dim(this);
                            });
                    Severity: Minor
                    Found in app/admin_files/wp-lists.js and 2 other locations - About 30 mins to fix
                    app/admin_files/wp-lists.js on lines 397..399
                    app/admin_files/wp-lists.js on lines 405..407

                    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