burningpony/phd_checker

View on GitHub
lib/assets/javascripts/jquery-ui-timepicker-addon.js

Summary

Maintainability
F
1 wk
Test Coverage

File jquery-ui-timepicker-addon.js has 570 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
* jQuery timepicker addon
* By: Trent Richardson [http://trentrichardson.com]
* Version 0.9
* Last Modified: 11/29/2010
Severity: Major
Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 1 day to fix

    Function _injectTimePicker has 184 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _injectTimePicker: function() {
            var $dp = this.inst.dpDiv,
                o = this._defaults,
                tp_inst = this,
                // Added by Peter Medeiros:
    Severity: Major
    Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 7 hrs to fix

      Function _newInst has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _newInst: function($input, o) {
              var tp_inst = new Timepicker(),
                  inlineSettings = {};
      
              for (var attrName in this._defaults) {
      Severity: Minor
      Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 1 hr to fix

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

        function Timepicker() {
            this.regional = []; // Available regional settings, indexed by language code
            this.regional[''] = { // Default regional settings
                currentText: 'Now',
                closeText: 'Done',
        Severity: Minor
        Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 1 hr to fix

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

              _formatTime: function(time, format, ampm) {
                  if (ampm == undefined) ampm = this._defaults.ampm;
                  time = time || { hour: this.hour, minute: this.minute, second: this.second, ampm: this.ampm };
                  var tmptime = format || this._defaults.timeFormat.toString();
          
          
          Severity: Minor
          Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 1 hr to fix

            Function _parseTime has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _parseTime: function(timeString, withDate) {
                    var regstr = this._defaults.timeFormat.toString()
                            .replace(/h{1,2}/ig, '(\\d?\\d)')
                            .replace(/m{1,2}/ig, '(\\d?\\d)')
                            .replace(/s{1,2}/ig, '(\\d?\\d)')
            Severity: Minor
            Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                                          } else if (aph == 12) h = 12;
                                          else h = aph + 12;
              Severity: Major
              Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (h == 0) tmph = 12 +'a';
                                        else if (h < 12) tmph += 'a';
                                        else tmph += 'p';
                Severity: Major
                Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                  if (aph == 12) h = 0;
                                                  else h = aph;
                  Severity: Major
                  Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if ((hour < defaults.hourMin || hour > defaults.hourMax) || (minute < defaults.minuteMin || minute > defaults.minuteMax) || (second < defaults.secondMin || second > defaults.secondMax)) {
                                hour = defaults.hourMin;
                                minute = defaults.minuteMin;
                                second = defaults.secondMin;
                            }
                    Severity: Major
                    Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if (force || this.hour != hour || this.minute != minute || this.second != second || (this.ampm.length > 0 && this.ampm != ampm))
                                  hasChanged = true;
                      Severity: Major
                      Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js - About 40 mins to fix

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

                                    if (o.showMinute && o.minuteGrid > 0) {
                                        html += '<dd class="ui_tpicker_minute ui_tpicker_minute_' + o.minuteGrid + '">' +
                                                '<div id="ui_tpicker_minute_' + dp_id + '"' +
                                                ((o.showMinute) ? '' : noDisplay) + '></div>' +
                                                '<div style="padding-left: 1px"><table><tr>';
                        Severity: Major
                        Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 1 other location - About 7 hrs to fix
                        lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 287..301

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

                        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 (o.showSecond && o.secondGrid > 0) {
                                        html += '<dd class="ui_tpicker_second ui_tpicker_second_' + o.secondGrid + '">' +
                                                '<div id="ui_tpicker_second_' + dp_id + '"' +
                                                ((o.showSecond) ? '' : noDisplay) + '></div>' +
                                                '<div style="padding-left: 1px"><table><tr>';
                        Severity: Major
                        Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 1 other location - About 7 hrs to fix
                        lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 268..282

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

                        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

                                        $tp.find(".ui_tpicker_minute table").css({
                                            width: size + "%",
                                            marginLeft: (size / (-2 * minuteGridSize)) + "%",
                                            borderCollapse: 'collapse'
                                        }).find("td").each(function(index) {
                        Severity: Major
                        Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 1 other location - About 6 hrs to fix
                        lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 405..419

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

                        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

                                        $tp.find(".ui_tpicker_second table").css({
                                            width: size + "%",
                                            marginLeft: (size / (-2 * secondGridSize)) + "%",
                                            borderCollapse: 'collapse'
                                        }).find("td").each(function(index) {
                        Severity: Major
                        Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 1 other location - About 6 hrs to fix
                        lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 387..401

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

                        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

                                    this.second_slider = $tp.find('#ui_tpicker_second_'+ dp_id).slider({
                                        orientation: "horizontal",
                                        value: this.second,
                                        min: o.secondMin,
                                        max: secMax,
                        Severity: Major
                        Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 1 other location - About 3 hrs to fix
                        lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 315..325

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

                        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

                                    this.hour_slider = $tp.find('#ui_tpicker_hour_'+ dp_id).slider({
                                        orientation: "horizontal",
                                        value: this.hour,
                                        min: o.hourMin,
                                        max: hourMax,
                        Severity: Major
                        Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 1 other location - About 3 hrs to fix
                        lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 342..352

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

                        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

                                    html += '<dt class="ui_tpicker_minute_label" id="ui_tpicker_minute_label_' + dp_id + '"' +
                                            ((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>';
                        Severity: Minor
                        Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 1 other location - About 30 mins to fix
                        lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 284..285

                        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

                                    html += '<dt class="ui_tpicker_second_label" id="ui_tpicker_second_label_' + dp_id + '"' +
                                            ((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>';
                        Severity: Minor
                        Found in lib/assets/javascripts/jquery-ui-timepicker-addon.js and 1 other location - About 30 mins to fix
                        lib/assets/javascripts/jquery-ui-timepicker-addon.js on lines 265..266

                        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