CaffGeek/MBACNationals

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

Summary

Maintainability
D
3 days
Test Coverage

Function ajaxSubmit has 150 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.fn.ajaxSubmit = function(options) {
    if (typeof options == 'function')
        options = { success: options };

    options = $.extend({
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/js/jquery/jquery.form.dev.js - About 6 hrs to fix

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

    /*
     * jQuery Form Plugin
     * version: 2.02 (12/16/2007)
     * @requires jQuery v1.1 or later
     *
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/js/jquery/jquery.form.dev.js - About 3 hrs to fix

      Function fileUpload has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function fileUpload() {
              var form = $form[0];
              var opts = $.extend({}, $.ajaxSettings, options);
      
              var id = 'jqFormIO' + $.fn.ajaxSubmit.counter++;
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/js/jquery/jquery.form.dev.js - About 3 hrs to fix

        Consider simplifying this complex logical expression.
        Open

            if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
                (t == 'checkbox' || t == 'radio') && !el.checked ||
                (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
                tag == 'select' && el.selectedIndex == -1))
                    return null;
        Severity: Critical
        Found in Web.Admin/2014/wordpress/wp-includes/js/jquery/jquery.form.dev.js - About 3 hrs to fix

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

                  function cb() {
                      if (cbInvoked++) return;
          
                      io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
          
          
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/js/jquery/jquery.form.dev.js - About 1 hr to fix

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

            $.fn.formToArray = function(semantic) {
                var a = [];
                if (this.length == 0) return a;
            
                var form = this[0];
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/js/jquery/jquery.form.dev.js - About 1 hr to fix

              Avoid too many return statements within this function.
              Open

                  return el.value;
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-includes/js/jquery/jquery.form.dev.js - About 30 mins to fix

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

                        if (v && v.constructor == Array) {
                            for (var i=0,max=v.length; i < max; i++)
                                a.push({name: n, value: v[i]});
                        }
                        else if (v !== null && typeof v != 'undefined')
                Web.Admin/2014/wordpress/wp-includes/js/jquery/jquery.form.dev.js on lines 541..546

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

                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 (v && v.constructor == Array) {
                            for(var j=0, jmax=v.length; j < jmax; j++)
                                a.push({name: n, value: v[j]});
                        }
                        else if (v !== null && typeof v != 'undefined')
                Web.Admin/2014/wordpress/wp-includes/js/jquery/jquery.form.dev.js on lines 621..626

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

                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

                            if(!el.disabled && form.clk == el)
                                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
                Web.Admin/2014/wordpress/wp-includes/js/jquery/jquery.form.dev.js on lines 555..556

                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

                            if(n && !input.disabled && input.type == "image" && form.clk == input)
                                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
                Web.Admin/2014/wordpress/wp-includes/js/jquery/jquery.form.dev.js on lines 535..536

                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

                There are no issues that match your filters.

                Category
                Status