NUBIC/surveyor

View on GitHub

Showing 371 of 658 total issues

Function focus has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    focus: function( event, item ) {
        var nested, focused;
        this.blur( event, event && event.type === "focus" );

        this._scrollIntoView( item );
Severity: Minor
Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

    Function _mouseStop has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _mouseStop: function(event) {
    
            this.resizing = false;
            var pr, ista, soffseth, soffsetw, s, left, top,
                o = this.options, that = this;
    Severity: Minor
    Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

      Function off has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          off: function( types, selector, fn ) {
              var handleObj, type;
              if ( types && types.preventDefault && types.handleObj ) {
                  // ( event )  dispatched jQuery.Event
                  handleObj = types.handleObj;
      Severity: Minor
      Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 1 hr to fix

        Function offset has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        jQuery.fn.offset = function( options ) {
            if ( arguments.length ) {
                return options === undefined ?
                    this :
                    this.each(function( i ) {
        Severity: Minor
        Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 1 hr to fix

          Method method_missing has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def method_missing(missing_method, *args, &block)
                method_name, reference_identifier = missing_method.to_s.split("_", 2)
                type = full(method_name)
                Surveyor::Parser.raise_error( "\"#{type}\" is not a surveyor method." )if !%w(survey survey_translation survey_section question_group question dependency dependency_condition answer validation validation_condition).include?(type)
          
          
          Severity: Minor
          Found in lib/surveyor/parser.rb - 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 lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.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 lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                        if ( this.options.tolerance === "pointer" ||
                            this.options.forcePointerForContainers ||
                            (this.options.tolerance !== "pointer" && this.helperProportions[this.floating ? "width" : "height"] > item[this.floating ? "width" : "height"])
                        ) {
                            return isOverElement;
                Severity: Major
                Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                              if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
                                  (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
                              }
                  Severity: Major
                  Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                            if((this.options.revert === "invalid" && !dropped) || (this.options.revert === "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
                                $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
                                    if(that._trigger("stop", event) !== false) {
                                        that._clear();
                                    }
                    Severity: Major
                    Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                      if ( jQuery.expr && jQuery.expr.filters ) {
                          jQuery.expr.filters.hidden = function( elem ) {
                              return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
                          };
                      
                      
                      Severity: Major
                      Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                        if ( unit !== "px" && start ) {
                                            // Iteratively approximate from a nonzero starting point
                                            // Prefer the current property, because this process will be trivial if it uses the same units
                                            // Fallback to end or a simple constant
                                            start = jQuery.css( tween.elem, prop, true ) || end || 1;
                        Severity: Major
                        Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 1 hr to fix

                          Method load_and_update_response_set has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def load_and_update_response_set
                                ResponseSet.transaction do
                                  @response_set = ResponseSet.includes({:responses => :answer}).where(:access_code => params[:response_set_code]).first
                                  if @response_set
                                    saved = true
                          Severity: Minor
                          Found in lib/surveyor/surveyor_controller_methods.rb - About 55 mins 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

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

                            def unparse(dsl)
                              with_defaults = SurveySection.new(:title => title)
                              attrs = self.attributes.delete_if{|k,v| with_defaults[k] == v or %w(created_at updated_at id survey_id).include? k}.symbolize_keys!
                              group_questions = []
                              dsl << "  section \"#{title}\""
                          Severity: Minor
                          Found in lib/surveyor/unparser.rb - About 55 mins 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 create has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                          create: function(tp_inst, obj, unit, val, min, max, step){
                          Severity: Major
                          Found in lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js - About 50 mins to fix

                            Function access has 7 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
                            Severity: Major
                            Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 50 mins to fix

                              Function create has 7 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                              create: function(tp_inst, obj, unit, val, min, max, step){
                              Severity: Major
                              Found in lib/assets/javascripts/surveyor/jquery-ui-timepicker-addon.js - About 50 mins to fix

                                Method generate_pick_none_input_html has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                      def generate_pick_none_input_html(value, default_value, css_class, response_class, disabled, input_mask, input_mask_placeholder)
                                Severity: Major
                                Found in lib/surveyor/helpers/surveyor_helper_methods.rb - About 50 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                                      if ( xhrOnUnloadAbort ) {
                                                                          delete xhrCallbacks[ handle ];
                                                                      }
                                  Severity: Major
                                  Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if ( (seed = find(
                                                            token.matches[0].replace( runescape, funescape ),
                                                            rsibling.test( tokens[0].type ) && context.parentNode || context
                                                        )) ) {
                                    
                                    
                                    Severity: Major
                                    Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language