kuasha/cosmos

View on GitHub
samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js

Summary

Maintainability
F
5 mos
Test Coverage

File datepicker.js has 1630 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * jQuery UI Datepicker 1.11.0
 * http://jqueryui.com
 *
 * Copyright 2014 jQuery Foundation and other contributors
Severity: Major
Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 4 days to fix

    Function _generateHTML has 169 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _generateHTML: function(inst) {
            var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
                controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
                monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
                selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
    Severity: Major
    Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 6 hrs to fix

      Function parseDate has 148 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          parseDate: function (format, value, settings) {
              if (format == null || value == null) {
                  throw "Invalid arguments";
              }
      
      
      Severity: Major
      Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 5 hrs to fix

        Function _doKeyDown has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _doKeyDown: function(event) {
                var onSelect, dateStr, sel,
                    inst = $.datepicker._getInst(event.target),
                    handled = true,
                    isRTL = inst.dpDiv.is(".ui-datepicker-rtl");
        Severity: Major
        Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 3 hrs to fix

          Function formatDate has 79 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              formatDate: function (format, date, settings) {
                  if (!date) {
                      return "";
                  }
          
          
          Severity: Major
          Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 3 hrs to fix

            Function Datepicker has 76 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Datepicker() {
                this._curInst = null; // The current instance in use
                this._keyEvent = false; // If the last event was a key event
                this._disabledInputs = []; // List of date picker inputs that have been disabled
                this._datepickerShowing = false; // True if the popup picker is showing , false if not
            Severity: Major
            Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 3 hrs to fix

              Function _showDatepicker has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _showDatepicker: function(input) {
                      input = input.target || input;
                      if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
                          input = $("input", input.parentNode)[0];
                      }
              Severity: Major
              Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 2 hrs to fix

                Function _generateMonthYearHeader has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
                            secondary, monthNames, monthNamesShort) {
                
                        var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
                            changeMonth = this._get(inst, "changeMonth"),
                Severity: Major
                Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 2 hrs to fix

                  Function _determineDate has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      _determineDate: function(inst, date, defaultDate) {
                          var offsetNumeric = function(offset) {
                                  var date = new Date();
                                  date.setDate(date.getDate() + offset);
                                  return date;
                  Severity: Minor
                  Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if ( ( ( $target[0].id !== $.datepicker._mainDivId &&
                                    $target.parents("#" + $.datepicker._mainDivId).length === 0 &&
                                    !$target.hasClass($.datepicker.markerClassName) &&
                                    !$target.closest("." + $.datepicker._triggerClass).length &&
                                    $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
                    Severity: Critical
                    Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

                      Function _attachments has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _attachments: function(input, inst) {
                              var showOn, buttonText, buttonImage,
                                  appendText = this._get(inst, "appendText"),
                                  isRTL = this._get(inst, "isRTL");
                      
                      
                      Severity: Minor
                      Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

                        Function _optionDatepicker has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            _optionDatepicker: function(target, name, value) {
                                var settings, date, minDate, maxDate,
                                    inst = this._getInst(target);
                        
                                if (arguments.length === 2 && typeof name === "string") {
                        Severity: Minor
                        Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

                          Function _possibleChars has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              _possibleChars: function (format) {
                                  var iFormat,
                                      chars = "",
                                      literal = false,
                                      // Check whether a format character is doubled
                          Severity: Minor
                          Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

                            Function _dialogDatepicker has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                _dialogDatepicker: function(input, date, onSelect, settings, pos) {
                                    var id, browserWidth, browserHeight, scrollX, scrollY,
                                        inst = this._dialogInst; // internal instance
                            
                                    if (!inst) {
                            Severity: Minor
                            Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

                              Function _hideDatepicker has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  _hideDatepicker: function(input) {
                                      var showAnim, duration, postProcess, onClose,
                                          inst = this._curInst;
                              
                                      if (!inst || (input && inst !== $.data(input, "datepicker"))) {
                              Severity: Minor
                              Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

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

                                            offsetString = function(offset) {
                                                try {
                                                    return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
                                                        offset, $.datepicker._getFormatConfig(inst));
                                                }
                                Severity: Minor
                                Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

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

                                      _attachHandlers: function(inst) {
                                          var stepMonths = this._get(inst, "stepMonths"),
                                              id = "#" + inst.id.replace( /\\\\/g, "\\" );
                                          inst.dpDiv.find("[data-handler]").map(function () {
                                              var handler = {
                                  Severity: Minor
                                  Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

                                    Function _updateDatepicker has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        _updateDatepicker: function(inst) {
                                            this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
                                            datepicker_instActive = inst; // for delegate hover events
                                            inst.dpDiv.empty().append(this._generateHTML(inst));
                                            this._attachHandlers(inst);
                                    Severity: Minor
                                    Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

                                      Function _generateMonthYearHeader has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
                                                  secondary, monthNames, monthNamesShort) {
                                      Severity: Major
                                      Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

                                        Consider simplifying this complex logical expression.
                                        Open

                                                if ($.datepicker._datepickerShowing) {
                                                    switch (event.keyCode) {
                                                        case 9: $.datepicker._hideDatepicker();
                                                                handled = false;
                                                                break; // hide on tab out
                                        Severity: Major
                                        Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 1 hr to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                                      if (lookAhead("'")) {
                                                                          output += "'";
                                                                      } else {
                                                                          literal = true;
                                                                      }
                                          Severity: Major
                                          Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                    switch (col) {
                                                                        case 0: calender += " ui-datepicker-group-first";
                                                                            cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
                                                                        case numMonths[1]-1: calender += " ui-datepicker-group-last";
                                                                            cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
                                            Severity: Major
                                            Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 45 mins to fix

                                              Function _dialogDatepicker has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                              Open

                                                  _dialogDatepicker: function(input, date, onSelect, settings, pos) {
                                              Severity: Minor
                                              Found in samples/adminpanel/app/bower_components/jquery-ui/ui/datepicker.js - About 35 mins to fix

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

                                                $.extend(Datepicker.prototype, {
                                                    /* Class name added to elements to indicate already configured with a date picker. */
                                                    markerClassName: "hasDatepicker",
                                                
                                                    //Keep track of the maximum number of rows displayed (see #7043)
                                                samples/adminpanel/app/bower_components/jquery-ui/jquery-ui.js on lines 7828..9665

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

                                                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

                                                function Datepicker() {
                                                    this._curInst = null; // The current instance in use
                                                    this._keyEvent = false; // If the last event was a key event
                                                    this._disabledInputs = []; // List of date picker inputs that have been disabled
                                                    this._datepickerShowing = false; // True if the popup picker is showing , false if not
                                                samples/adminpanel/app/bower_components/jquery-ui/jquery-ui.js on lines 7738..7826

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

                                                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 3 locations. Consider refactoring.
                                                Open

                                                $.fn.datepicker = function(options){
                                                
                                                    /* Verify an empty collection wasn't passed - Fixes #6976 */
                                                    if ( !this.length ) {
                                                        return this;
                                                samples/adminpanel/app/bower_components/jquery-ui/jquery-ui.js on lines 9712..9745
                                                samples/adminpanel/app/lib/js/jquery-ui.js on lines 9598..9631

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

                                                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 3 locations. Consider refactoring.
                                                Open

                                                function datepicker_bindHover(dpDiv) {
                                                    var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
                                                    return dpDiv.delegate(selector, "mouseout", function() {
                                                            $(this).removeClass("ui-state-hover");
                                                            if (this.className.indexOf("ui-datepicker-prev") !== -1) {
                                                samples/adminpanel/app/bower_components/jquery-ui/jquery-ui.js on lines 9672..9695
                                                samples/adminpanel/app/lib/js/jquery-ui.js on lines 9558..9581

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

                                                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

                                                function datepicker_getZindex( elem ) {
                                                    var position, value;
                                                    while ( elem.length && elem[ 0 ] !== document ) {
                                                        // Ignore z-index if position is set to a value where z-index is ignored by the browser
                                                        // This makes behavior of this function consistent across browsers
                                                samples/adminpanel/app/bower_components/jquery-ui/jquery-ui.js on lines 7711..7732

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

                                                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 3 locations. Consider refactoring.
                                                Open

                                                function datepicker_extendRemove(target, props) {
                                                    $.extend(target, props);
                                                    for (var name in props) {
                                                        if (props[name] == null) {
                                                            target[name] = props[name];
                                                samples/adminpanel/app/bower_components/jquery-ui/jquery-ui.js on lines 9698..9706
                                                samples/adminpanel/app/lib/js/jquery-ui.js on lines 9584..9592

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

                                                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 15 locations. Consider refactoring.
                                                Open

                                                (function( factory ) {
                                                    if ( typeof define === "function" && define.amd ) {
                                                
                                                        // AMD. Register as an anonymous module.
                                                        define([
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-blind.js on lines 11..90
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-bounce.js on lines 11..123
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-clip.js on lines 11..77
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-drop.js on lines 11..75
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-explode.js on lines 11..107
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-fade.js on lines 11..40
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-fold.js on lines 11..86
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-highlight.js on lines 11..60
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-pulsate.js on lines 11..73
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-shake.js on lines 11..84
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-size.js on lines 11..233
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-slide.js on lines 11..74
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/effect-transfer.js on lines 11..57
                                                samples/adminpanel/app/bower_components/jquery-ui/ui/mouse.js on lines 11..187

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

                                                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