NUBIC/surveyor

View on GitHub

Showing 658 of 658 total issues

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 lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 3 hrs to fix

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

                    if (this.millisec_slider) {
                        this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });
                        this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
                    }
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 631..634
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 635..638
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 639..642

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

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

                    if (this.hour_slider) {
                        this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });
                        this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
                    }
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 635..638
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 639..642
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 643..646

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

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

                    if (this.second_slider) {
                        this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax });
                        this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
                    }
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 631..634
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 635..638
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 643..646

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

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

                    if (this.minute_slider) {
                        this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax });
                        this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
                    }
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 631..634
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 639..642
    lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js on lines 643..646

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

    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

    Method unparse has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

      def unparse(dsl)
        with_defaults = Answer.new(:text => text)
        attrs = self.attributes.delete_if{|k,v| with_defaults[k] == v or %w(created_at updated_at reference_identifier response_class id question_id api_id).include? k}.symbolize_keys!
        attrs.delete(:is_exclusive) if text == "Omit" && is_exclusive == true
        attrs.merge!({:is_exclusive => false}) if text == "Omit" && is_exclusive == false
    Severity: Minor
    Found in lib/surveyor/unparser.rb - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function Sizzle has 77 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function Sizzle( selector, context, results, seed ) {
        var match, elem, m, nodeType,
            // QSA vars
            i, groups, old, nid, newContext, newSelector;
    
    
    Severity: Major
    Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 3 hrs to fix

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

              next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
                  "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
                  " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
                  (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+ nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "w" : "e") + "'>" + nextText + "</span></a>"));
      Severity: Major
      Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 3 hrs to fix
      lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 4659..4662

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

      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

              prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
                  "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
                  " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
                  (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+ prevText +"'><span class='ui-icon ui-icon-circle-triangle-" + ( isRTL ? "e" : "w") + "'>" + prevText + "</span></a>"));
      Severity: Major
      Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 3 hrs to fix
      lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 4669..4672

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

      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

          _activate: function(event) {
              var draggable = $.ui.ddmanager.current;
              if(this.options.activeClass) {
                  this.element.addClass(this.options.activeClass);
              }
      Severity: Major
      Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 3 hrs to fix
      lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 6825..6833

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

      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 (woset + that.size.width >= that.parentData.width) {
                  that.size.width = that.parentData.width - woset;
                  if (pRatio) {
                      that.size.height = that.size.width / that.aspectRatio;
                  }
      Severity: Major
      Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 3 hrs to fix
      lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 10843..10848

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

      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

          _deactivate: function(event) {
              var draggable = $.ui.ddmanager.current;
              if(this.options.activeClass) {
                  this.element.removeClass(this.options.activeClass);
              }
      Severity: Major
      Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 3 hrs to fix
      lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 6815..6823

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

      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 (hoset + that.size.height >= that.parentData.height) {
                  that.size.height = that.parentData.height - hoset;
                  if (pRatio) {
                      that.size.width = that.size.height * that.aspectRatio;
                  }
      Severity: Major
      Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 3 hrs to fix
      lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 10836..10841

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

      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

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

          _clear: function(event, noPropagation) {
      
              this.reverting = false;
              // We delay all events that have to be triggered to after the point where the placeholder has been removed and
              // everything else normalized again
      Severity: Major
      Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 3 hrs to fix

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

                _onTimeChange: function() {
                    var hour = (this.hour_slider) ? this.control.value(this, this.hour_slider, 'hour') : false,
                        minute = (this.minute_slider) ? this.control.value(this, this.minute_slider, 'minute') : false,
                        second = (this.second_slider) ? this.control.value(this, this.second_slider, 'second') : false,
                        millisec = (this.millisec_slider) ? this.control.value(this, this.millisec_slider, 'millisec') : false,
        Severity: Major
        Found in lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js - About 3 hrs to fix

          Function _mouseStart has 75 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _mouseStart: function(event, overrideHandle, noActivation) {
          
                  var i,
                      o = this.options;
          
          
          Severity: Major
          Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 3 hrs to fix

            Function _mouseDrag has 75 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                _mouseDrag: function(event) {
                    var i, item, itemElement, intersection,
                        o = this.options,
                        scrolled = false;
            
            
            Severity: Major
            Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 3 hrs to fix

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

                  $.datepicker._optionDatepicker = function(target, name, value) {
                      var inst = this._getInst(target),
                          name_clone;
                      if (!inst) {
                          return null;
              Severity: Major
              Found in lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js - About 3 hrs to fix

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

                            child.from = {
                                height: c_original.height * factor.from.y,
                                width: c_original.width * factor.from.x,
                                outerHeight: c_original.outerHeight * factor.from.y,
                                outerWidth: c_original.outerWidth * factor.from.x
                Severity: Major
                Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 3 hrs to fix
                lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 9110..9115

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

                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 ( factor.from.y !== factor.to.y ) {
                            props = props.concat( vProps );
                            el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
                            el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
                        }
                Severity: Major
                Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js and 1 other location - About 3 hrs to fix
                lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js on lines 9051..9055

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

                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

                Severity
                Category
                Status
                Source
                Language