sleepepi/sleepportal

View on GitHub

Showing 436 of 436 total issues

Avoid deeply nested control flow statements.
Open

                    for (i = 0; i < dataLength; i++) {
                        pt = data[i];
                        xData[i] = pt[0];
                        yData[i] = pt[1];
                    }
Severity: Major
Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        } else if (key === 'x' && nodeName === 'text') {
                            for (i = 0; i < element.childNodes.length; i++) {
                                child = element.childNodes[i];
                                // if the x values are equal, the tspan represents a linebreak
                                if (attr(child, 'x') === attr(element, 'x')) {
    Severity: Major
    Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if (result !== UNDEFINED) {
                              value = result; // the attribute setter has returned a new value to set
                          }
      Severity: Major
      Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (connector) {
                                        point.connector = connector.destroy();
                                    }
        Severity: Major
        Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  while (slots[slotIndex] === null) { // make sure it is not taken
                                      slotIndex++;
                                  }
          Severity: Major
          Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 45 mins to fix

            Function drawCircle has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    drawCircle: function (x, y, radius, lineColor, fillColor, lineWidth) {
            Severity: Minor
            Found in app/assets/javascripts/external/jquery.sparkline.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (val > 0) {
                                              stackTotals[i] += val;
                                          }
              Severity: Major
              Found in app/assets/javascripts/external/jquery.sparkline.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                if ($.isFunction(tags)) tags=tags();
                Severity: Major
                Found in app/assets/javascripts/external/select2.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (wrapper.stroke && wrapper['stroke-width']) {
                                              attr(element, 'stroke', wrapper.stroke);
                                              attr(element, 'stroke-width', wrapper['stroke-width']);
                                              wrapper.hasStroke = true;
                                          } else if (key === 'stroke-width' && value === 0 && wrapper.hasStroke) {
                  Severity: Major
                  Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (w) {
                                                x = axis.translate(pos); // don't handle log
                                                if (lastRight[lineNo] !== UNDEFINED && x < lastRight[lineNo]) {
                                                    overlap = true;
                                                }
                    Severity: Major
                    Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 45 mins to fix

                      Function drawLine has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              drawLine: function (x1, y1, x2, y2, lineColor, lineWidth) {
                      Severity: Minor
                      Found in app/assets/javascripts/external/jquery.sparkline.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                        $(tags).each(function() { if (equal(this.id, id)) { text = this.text; return false; } });
                        Severity: Major
                        Found in app/assets/javascripts/external/select2.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                        if left_token.blank? and right_token.blank?
                                          all_conditions << "#{numeric_string} BETWEEN #{range[0]} and #{range[1]}"
                                        else
                                          all_conditions << "#{numeric_string} #{left_token} #{range[0]} and #{numeric_string} #{right_token} #{range[1]}"
                                        end
                          Severity: Major
                          Found in app/models/resolver.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if (value && value.join) { // join path
                                                        value = value.join(' ');
                                                    }
                            Severity: Major
                            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if (equal(opts.id(token), opts.id(selection[i]))) {
                                                          dupe = true; break;
                                                      }
                              Severity: Major
                              Found in app/assets/javascripts/external/select2.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if (symbolName && /^(x|y|r|start|end|width|height|innerR|anchorX|anchorY)/.test(key)) {
                                                        // if one of the symbol size affecting parameters are changed,
                                                        // check all the others only once for each call to an element's
                                                        // .attr() method
                                                        if (!hasSetSymbolSize) {
                                Severity: Major
                                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                body_row[index] = (filtered_results.compact.size > 0) ? (filtered_results.compact.max).round(1) : 'n/a'
                                  Severity: Major
                                  Found in app/models/report.rb - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                elsif statistic == 'avg'
                                                  body_row[index] = (filtered_results.compact.size > 0) ? (filtered_results.compact.sum.to_f / filtered_results.compact.size).round(1) : 'n/a'
                                                elsif statistic == 'count'
                                                  body_row[index] = filtered_results.size
                                                elsif statistic == '%'
                                    Severity: Major
                                    Found in app/models/report.rb - About 45 mins to fix

                                      Method table_columns has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                        def table_columns(current_user, table, page = 1, per_page = -1, filter_unmapped = false, search = '')
                                      Severity: Minor
                                      Found in app/models/source.rb - About 45 mins to fix

                                        Method user_has_action? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                          def user_has_action?(current_user, action)
                                            return true if current_user.all_sources.include?(self)
                                            result = false
                                            blocked = false
                                            self.rules.each do |rule|
                                        Severity: Minor
                                        Found in app/models/source.rb - About 45 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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language