NUBIC/surveyor

View on GitHub

Showing 371 of 658 total issues

Function drag has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    drag: function(event, ui) {

        var inst = $(this).data("ui-draggable"), that = this;

        $.each(inst.sortables, function() {
Severity: Major
Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 2 hrs to fix

    Function drag has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        drag: function(event, ui) {
    
            var ts, bs, ls, rs, l, r, t, b, i, first,
                inst = $(this).data("ui-draggable"),
                o = inst.options,
    Severity: Major
    Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 2 hrs to fix

      Function Deferred has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          Deferred: function( func ) {
              var tuples = [
                      // action, add listener, listener list, final state
                      [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
                      [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
      Severity: Major
      Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 2 hrs to fix

        Function explode has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        $.effects.effect.explode = function( o, done ) {
        
            var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
                cells = rows,
                el = $( this ),
        Severity: Major
        Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 2 hrs to fix

          Function CHILD has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  "CHILD": function( type, what, argument, first, last ) {
                      var simple = type.slice( 0, 3 ) !== "nth",
                          forward = type.slice( -4 ) !== "last",
                          ofType = what === "of-type";
          
          
          Severity: Major
          Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 2 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                                    if ( forward && useCache ) {
                                        // Seek `elem` from a previously-cached index
                                        outerCache = parent[ expando ] || (parent[ expando ] = {});
                                        cache = outerCache[ type ] || [];
                                        nodeIndex = cache[0] === dirruns && cache[1];
            Severity: Critical
            Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 2 hrs to fix

              Function init has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  init: function( selector, context, rootjQuery ) {
                      var match, elem;
              
                      // HANDLE: $(""), $(null), $(undefined), $(false)
                      if ( !selector ) {
              Severity: Major
              Found in lib/assets/javascripts/surveyor/jquery-1.9.0.js - About 2 hrs to fix

                Function keydown has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        keydown: function( event ) {
                            /*jshint maxcomplexity:25*/
                            var allowed, curVal, newVal, step,
                                index = $( event.target ).data( "ui-slider-handle-index" );
                
                
                Severity: Major
                Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 2 hrs to fix

                  Method update_from_ui_hash has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def update_from_ui_hash(ui_hash)
                          transaction do
                            ui_hash.each do |ord, response_hash|
                              api_id = response_hash['api_id']
                              fail "api_id missing from response #{ord}" unless api_id
                  Severity: Minor
                  Found in lib/surveyor/models/response_set_methods.rb - About 2 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

                  Method method_missing has a Cognitive Complexity of 17 (exceeds 5 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 2 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 createWrapper has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      createWrapper: function( element ) {
                  
                          // if the element is already wrapped, return it
                          if ( element.parent().is( ".ui-effects-wrapper" )) {
                              return element.parent();
                  Severity: Major
                  Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.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 lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 2 hrs to fix

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

                          _mouseStart: function(event) {
                              var that = this,
                                  options = this.options;
                      
                              this.opos = [event.pageX, event.pageY];
                      Severity: Major
                      Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 2 hrs to fix

                        Function _generatePosition has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            _generatePosition: function(event) {
                        
                                var containment, co, top, left,
                                    o = this.options,
                                    scroll = this.cssPosition === "absolute" && !(this.scrollParent[0] !== document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent,
                        Severity: Major
                        Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 2 hrs to fix

                          Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              parse: function( red, green, blue, alpha ) {
                                  if ( red === undefined ) {
                                      this._rgba = [ null, null, null, null ];
                                      return this;
                                  }
                          Severity: Major
                          Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 2 hrs to fix

                            Method update has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def update
                                  question_ids_for_dependencies = (params[:r] || []).map{|k,v| v["question_id"] }.compact.uniq
                                  saved = load_and_update_response_set_with_retries
                            
                                  return redirect_with_message(surveyor_finish, :notice, t('surveyor.completed_survey')) if saved && params[:finish]
                            Severity: Minor
                            Found in lib/surveyor/surveyor_controller_methods.rb - About 2 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 _processTabs has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                _processTabs: function() {
                                    var that = this;
                            
                                    this.tablist = this._getList()
                                        .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
                            Severity: Major
                            Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 2 hrs to fix

                              Function keydown has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                          keydown: function( event ) {
                                              /*jshint maxcomplexity:15*/
                                              if ( this.element.prop( "readOnly" ) ) {
                                                  suppressKeyPress = true;
                                                  suppressInput = true;
                              Severity: Major
                              Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 2 hrs to fix

                                Function _refreshValue has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    _refreshValue: function() {
                                        var lastValPercent, valPercent, value, valueMin, valueMax,
                                            oRange = this.options.range,
                                            o = this.options,
                                            that = this,
                                Severity: Major
                                Found in lib/assets/javascripts/surveyor/jquery-ui-1.10.0.custom.js - About 2 hrs to fix

                                  File redcap_parser.rb has 252 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  %w(survey survey_section question_group question dependency dependency_condition answer validation validation_condition).each {|model| require model }
                                  require 'active_support' # for humanize
                                  module Surveyor
                                    class RedcapParserError < StandardError; end
                                    class RedcapParser
                                  Severity: Minor
                                  Found in lib/surveyor/redcap_parser.rb - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language