rilwis/meta-box

View on GitHub
js/validation/jquery.validate.js

Summary

Maintainability
F
1 wk
Test Coverage

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

/*!
 * jQuery Validation Plugin v1.20.0
 *
 * https://jqueryvalidation.org/
 *
Severity: Major
Found in js/validation/jquery.validate.js - About 3 days to fix

    Function validate has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        validate: function( options ) {
    
            // If nothing is selected, return nothing; can't chain anyway
            if ( !this.length ) {
                if ( options && options.debug && window.console ) {
    Severity: Major
    Found in js/validation/jquery.validate.js - About 2 hrs to fix

      Function showLabel has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              showLabel: function( element, message ) {
                  var place, group, errorID, v,
                      error = this.errorsFor( element ),
                      elementID = this.idOrName( element ),
                      describedBy = $( element ).attr( "aria-describedby" );
      Severity: Major
      Found in js/validation/jquery.validate.js - About 2 hrs to fix

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

            rules: function( command, argument ) {
                var element = this[ 0 ],
                    isContentEditable = typeof this.attr( "contenteditable" ) !== "undefined" && this.attr( "contenteditable" ) !== "false",
                    settings, staticRules, existingRules, data, param, filtered;
        
        
        Severity: Major
        Found in js/validation/jquery.validate.js - About 2 hrs to fix

          Function normalizeRules has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              normalizeRules: function( rules, element ) {
          
                  // Handle dependency check
                  $.each( rules, function( prop, val ) {
          
          
          Severity: Major
          Found in js/validation/jquery.validate.js - About 2 hrs to fix

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

                    check: function( element ) {
                        element = this.validationTargetFor( this.clean( element ) );
            
                        var rules = $( element ).rules(),
                            rulesCount = $.map( rules, function( n, i ) {
            Severity: Major
            Found in js/validation/jquery.validate.js - About 2 hrs to fix

              Function init has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      init: function() {
                          this.labelContainer = $( this.settings.errorLabelContainer );
                          this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm );
                          this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer );
                          this.submitted = {};
              Severity: Minor
              Found in js/validation/jquery.validate.js - About 2 hrs to fix

                Function remote has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        remote: function( value, element, param, method ) {
                            if ( this.optional( element ) ) {
                                return "dependency-mismatch";
                            }
                
                
                Severity: Minor
                Found in js/validation/jquery.validate.js - About 2 hrs to fix

                  Function element has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          element: function( element ) {
                              var cleanElement = this.clean( element ),
                                  checkElement = this.validationTargetFor( cleanElement ),
                                  v = this,
                                  result = true,
                  Severity: Minor
                  Found in js/validation/jquery.validate.js - About 1 hr to fix

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

                            elementValue: function( element ) {
                                var $element = $( element ),
                                    type = element.type,
                                    isContentEditable = typeof $element.attr( "contenteditable" ) !== "undefined" && $element.attr( "contenteditable" ) !== "false",
                                    val, idx;
                    Severity: Minor
                    Found in js/validation/jquery.validate.js - About 1 hr to fix

                      Avoid too many return statements within this function.
                      Open

                                  return val;
                      Severity: Major
                      Found in js/validation/jquery.validate.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return data;
                        Severity: Major
                        Found in js/validation/jquery.validate.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                          return val.replace( /\r/g, "" );
                          Severity: Major
                          Found in js/validation/jquery.validate.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                                return val.substr( idx + 1 );
                            Severity: Major
                            Found in js/validation/jquery.validate.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                              return val;
                              Severity: Major
                              Found in js/validation/jquery.validate.js - About 30 mins to fix

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

                                        unhighlight: function( element, errorClass, validClass ) {
                                            if ( element.type === "radio" ) {
                                                this.findByName( element.name ).removeClass( errorClass ).addClass( validClass );
                                            } else {
                                                $( element ).removeClass( errorClass ).addClass( validClass );
                                Severity: Major
                                Found in js/validation/jquery.validate.js and 1 other location - About 2 hrs to fix
                                js/validation/jquery.validate.js on lines 350..356

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

                                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

                                        highlight: function( element, errorClass, validClass ) {
                                            if ( element.type === "radio" ) {
                                                this.findByName( element.name ).addClass( errorClass ).removeClass( validClass );
                                            } else {
                                                $( element ).addClass( errorClass ).removeClass( validClass );
                                Severity: Major
                                Found in js/validation/jquery.validate.js and 1 other location - About 2 hrs to fix
                                js/validation/jquery.validate.js on lines 357..363

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

                                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

                                        minlength: function( value, element, param ) {
                                            var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
                                            return this.optional( element ) || length >= param;
                                        },
                                Severity: Major
                                Found in js/validation/jquery.validate.js and 1 other location - About 1 hr to fix
                                js/validation/jquery.validate.js on lines 1519..1522

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

                                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

                                        maxlength: function( value, element, param ) {
                                            var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
                                            return this.optional( element ) || length <= param;
                                        },
                                Severity: Major
                                Found in js/validation/jquery.validate.js and 1 other location - About 1 hr to fix
                                js/validation/jquery.validate.js on lines 1513..1516

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

                                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 ( this.settings.highlight ) {
                                                    this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
                                                }
                                Severity: Minor
                                Found in js/validation/jquery.validate.js and 1 other location - About 30 mins to fix
                                js/validation/jquery.validate.js on lines 935..937

                                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

                                                for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) {
                                                    this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass );
                                                }
                                Severity: Minor
                                Found in js/validation/jquery.validate.js and 1 other location - About 30 mins to fix
                                js/validation/jquery.validate.js on lines 921..923

                                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