Dogfalo/materialize

View on GitHub
js/forms.js

Summary

Maintainability
F
3 days
Test Coverage

File forms.js has 584 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function ($) {
  $(document).ready(function() {

    // Function to update labels of text fields
    Materialize.updateTextFields = function() {
Severity: Major
Found in js/forms.js - About 1 day to fix

    Function material_select has 232 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      $.fn.material_select = function (callback) {
        $(this).each(function(){
          var $select = $(this);
    
          if ($select.hasClass('browser-default')) {
    Severity: Major
    Found in js/forms.js - About 1 day to fix

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

          $.fn.autocomplete = function (options) {
            // Defaults
            var defaults = {
              data: {},
              limit: Infinity,
      Severity: Major
      Found in js/forms.js - About 5 hrs to fix

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

                  onKeyDown = function(e){
                    // TAB - switch to another input
                    if(e.which == 9){
                      $newSelect.trigger('close');
                      return;
        Severity: Minor
        Found in js/forms.js - About 2 hrs to fix

          Function textareaAutoResize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function textareaAutoResize($textarea) {
                // Set font properties of hiddenDiv
          
                var fontFamily = $textarea.css('font-family');
                var fontSize = $textarea.css('font-size');
          Severity: Minor
          Found in js/forms.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                              if (data.hasOwnProperty(key) &&
                                  key.toLowerCase().indexOf(val) !== -1) {
                                // Break if past limit
                                if (count >= options.limit) {
                                  break;
            Severity: Major
            Found in js/forms.js - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status