XoopsModules25x/smallworld

View on GitHub
assets/js/jquery.form.js

Summary

Maintainability
F
4 days
Test Coverage

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

    $.fn.ajaxSubmit = function (options) {
        // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
        if (!this.length) {
            log('ajaxSubmit: skipping submit process - no element selected');
            return this;
Severity: Major
Found in assets/js/jquery.form.js - About 1 day to fix

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

    /*!
     * jQuery Form Plugin
     * version: 2.43 (12-MAR-2010)
     * @requires jQuery v1.3.2 or later
     *
    Severity: Minor
    Found in assets/js/jquery.form.js - About 6 hrs to fix

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

              function fileUpload() {
                  var form = $form[0];
      
                  if ($(':input[name=submit]', form).length) {
                      alert('Error: Form elements must not be named "submit".');
      Severity: Major
      Found in assets/js/jquery.form.js - About 6 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 assets/js/jquery.form.js - About 3 hrs to fix

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

                      function cb() {
                          if (cbInvoked)
                              return;
          
                          var ok = true;
          Severity: Major
          Found in assets/js/jquery.form.js - About 2 hrs to fix

            Function doSubmit has 33 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: Minor
            Found in assets/js/jquery.form.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 assets/js/jquery.form.js - About 1 hr to fix

                Function ajaxForm has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    $.fn.ajaxForm = function (options) {
                        return this.ajaxFormUnbind().bind('submit.form-plugin', function (e) {
                            e.preventDefault();
                            $(this).ajaxSubmit(options);
                        }).bind('click.form-plugin', function (e) {
                Severity: Minor
                Found in assets/js/jquery.form.js - About 1 hr to fix

                  Function fieldValue has 26 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 (typeof successful == 'undefined') successful = true;
                  
                          if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
                  Severity: Minor
                  Found in assets/js/jquery.form.js - About 1 hr to fix

                    Avoid too many return statements within this function.
                    Open

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

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

                                return this;
                        Severity: Major
                        Found in assets/js/jquery.form.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')
                          Severity: Major
                          Found in assets/js/jquery.form.js and 1 other location - About 1 hr to fix
                          assets/js/jquery.form.js on lines 470..475

                          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')
                          Severity: Major
                          Found in assets/js/jquery.form.js and 1 other location - About 1 hr to fix
                          assets/js/jquery.form.js on lines 508..513

                          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

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

                          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 assets/js/jquery.form.js and 1 other location - About 45 mins to fix
                          assets/js/jquery.form.js on lines 483..483

                          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

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

                                          } else {
                                              form.clk_x = e.pageX - target.offsetLeft;
                                              form.clk_y = e.pageY - target.offsetTop;
                                          }
                          Severity: Minor
                          Found in assets/js/jquery.form.js and 1 other location - About 40 mins to fix
                          assets/js/jquery.colorbox.js on lines 921..924

                          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

                          There are no issues that match your filters.

                          Category
                          Status