wahyd4/ocelots

View on GitHub
public/jquery.form.js

Summary

Maintainability
F
1 wk
Test Coverage

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

$.fn.ajaxSubmit = function(options) {
    /*jshint scripturl:true */

    // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
    if (!this.length) {
Severity: Major
Found in public/jquery.form.js - About 2 days to fix

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

    /*!
     * jQuery Form Plugin
     * version: 3.20 (20-NOV-2012)
     * @requires jQuery v1.5 or later
     *
    Severity: Major
    Found in public/jquery.form.js - About 1 day to fix

      Function fileUploadIframe has 346 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function fileUploadIframe(a) {
              var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
              var useProp = !!$.fn.prop;
              var deferred = $.Deferred();
      
      
      Severity: Major
      Found in public/jquery.form.js - About 1 day to fix

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

                function cb(e) {
                    if (xhr.aborted || callbackProcessed) {
                        return;
                    }
                    try {
        Severity: Major
        Found in public/jquery.form.js - About 5 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 public/jquery.form.js - About 3 hrs to fix

            Function doSubmit has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function doSubmit() {
                        // make sure form attrs are set
                        var t = $form.attr('target'), a = $form.attr('action');
            
                        // update form attrs in IE friendly way
            Severity: Major
            Found in public/jquery.form.js - About 2 hrs to fix

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

              $.fn.formToArray = function(semantic, elements) {
                  var a = [];
                  if (this.length === 0) {
                      return a;
                  }
              Severity: Major
              Found in public/jquery.form.js - About 2 hrs to fix

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

                    function fileUploadXhr(a) {
                        var formdata = new FormData();
                
                        for (var i=0; i < a.length; i++) {
                            formdata.append(a[i].name, a[i].value);
                Severity: Minor
                Found in public/jquery.form.js - About 1 hr to fix

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

                  $.fieldValue = function(el, successful) {
                      var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
                      if (successful === undefined) {
                          successful = true;
                      }
                  Severity: Minor
                  Found in public/jquery.form.js - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    for (j=0; j < files.length; j++) {
                                        a.push({name: n, value: files[j], type: el.type});
                                    }
                    Severity: Major
                    Found in public/jquery.form.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  if (elements) 
                                      elements.push(el);
                      Severity: Major
                      Found in public/jquery.form.js - About 45 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return this;
                        Severity: Major
                        Found in public/jquery.form.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                                  return;
                          Severity: Major
                          Found in public/jquery.form.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return this;
                            Severity: Major
                            Found in public/jquery.form.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return $(el).val();
                              Severity: Major
                              Found in public/jquery.form.js - About 30 mins to fix

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

                                                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
                                Severity: Minor
                                Found in public/jquery.form.js and 1 other location - About 45 mins to fix
                                public/jquery.form.js on lines 879..879

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

                                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

                                            a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
                                Severity: Minor
                                Found in public/jquery.form.js and 1 other location - About 45 mins to fix
                                public/jquery.form.js on lines 839..839

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

                                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