sleepepi/sleepportal

View on GitHub

Showing 436 of 436 total issues

Function render has 123 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    render: function () {
        var plotLine = this,
            axis = plotLine.axis,
            horiz = axis.horiz,
            halfPointRange = (axis.pointRange || 0) / 2,
Severity: Major
Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 4 hrs to fix

    Function color has 123 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        color: function (color, elem, prop, wrapper) {
            var renderer = this,
                colorObject,
                regexRgba = /^rgba/,
                markup,
    Severity: Major
    Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 4 hrs to fix

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

                  if ($.isArray(options.get('colorMap'))) {
                      this.colorMapByIndex = options.get('colorMap');
                      this.colorMapByValue = null;
                  } else {
                      this.colorMapByIndex = null;
      Severity: Major
      Found in app/assets/javascripts/external/jquery.sparkline.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/external/jquery.sparkline.js on lines 1953..1962

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

      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

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

                  if ($.isArray(options.get('colorMap'))) {
                      this.colorMapByIndex = options.get('colorMap');
                      this.colorMapByValue = null;
                  } else {
                      this.colorMapByIndex = null;
      Severity: Major
      Found in app/assets/javascripts/external/jquery.sparkline.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/external/jquery.sparkline.js on lines 1811..1820

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

      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 init has 122 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              init: function (el, values, options, width, height) {
                  var barWidth = parseInt(options.get('barWidth'), 10),
                      barSpacing = parseInt(options.get('barSpacing'), 10),
                      chartRangeMin = options.get('chartRangeMin'),
                      chartRangeMax = options.get('chartRangeMax'),
      Severity: Major
      Found in app/assets/javascripts/external/jquery.sparkline.js - About 4 hrs to fix

        Function initContainer has 117 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                initContainer: function () {
        
                    var selection,
                        container = this.container,
                        dropdown = this.dropdown,
        Severity: Major
        Found in app/assets/javascripts/external/select2.js - About 4 hrs to fix

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

                          if (this.opened()) {
                              switch (e.which) {
                              case KEY.UP:
                              case KEY.DOWN:
                                  this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
          Severity: Major
          Found in app/assets/javascripts/external/select2.js and 1 other location - About 4 hrs to fix
          app/assets/javascripts/external/select2.js on lines 1444..1477

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

          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 (this.opened()) {
                              switch (e.which) {
                                  case KEY.UP:
                                  case KEY.DOWN:
                                      this.moveHighlight((e.which === KEY.UP) ? -1 : 1);
          Severity: Major
          Found in app/assets/javascripts/external/select2.js and 1 other location - About 4 hrs to fix
          app/assets/javascripts/external/select2.js on lines 1845..1862

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

          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 prepareOpts has 112 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  prepareOpts: function (opts) {
                      var element, select, idKey, ajaxUrl;
          
                      element = opts.element;
          
          
          Severity: Major
          Found in app/assets/javascripts/external/select2.js - About 4 hrs to fix

            Function renderItem has 107 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                renderItem: function (item) {
                    var legend = this,
                        chart = legend.chart,
                        renderer = chart.renderer,
                        options = legend.options,
            Severity: Major
            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 4 hrs to fix

              Function refresh has 107 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  refresh: function (point, mouseEvent) {
                      var tooltip = this,
                          chart = tooltip.chart,
                          label = tooltip.label,
                          options = tooltip.options,
              Severity: Major
              Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 4 hrs to fix

                Function render has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    render: function (index, old, opacity) {
                        var tick = this,
                            axis = tick.axis,
                            options = axis.options,
                            chart = axis.chart,
                Severity: Major
                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 4 hrs to fix

                  Function redraw has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      redraw: function (animation) {
                          var chart = this,
                              axes = chart.axes,
                              series = chart.series,
                              pointer = chart.pointer,
                  Severity: Major
                  Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 4 hrs to fix

                    Method finalize_report_table has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def finalize_report_table(current_user, include_html = true)
                    
                        result_hash = self.generate_report_table(current_user)
                    
                        values = result_hash[:values]
                    Severity: Major
                    Found in app/models/report.rb - About 3 hrs to fix

                      Method set_values has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def set_values
                          all_sources.each do |source|
                            wrapper = Aqueduct::Builder.wrapper(source, @current_user)
                      
                            mappings_for_select_clause = []
                      Severity: Minor
                      Found in app/models/master_resolver.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 render has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          render: function () {
                              var legend = this,
                                  chart = legend.chart,
                                  renderer = chart.renderer,
                                  legendGroup = legend.group,
                      Severity: Major
                      Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 3 hrs to fix

                        Function button has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            button: function (text, x, y, callback, normalState, hoverState, pressedState, disabledState, shape) {
                                var label = this.label(text, x, y, shape, null, null, null, null, 'button'),
                                    curState = 0,
                                    stateOptions,
                                    stateStyle,
                        Severity: Major
                        Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 3 hrs to fix

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

                                  init: function (pathAnim) {
                                      
                                      // extend the animate function to allow SVG animations
                                      var Fx = $.fx,
                                          Step = Fx.step,
                          Severity: Major
                          Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 3 hrs to fix

                            Function drawDataLabels has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                drawDataLabels: function () {
                                    
                                    var series = this,
                                        seriesOptions = series.options,
                                        cursor = seriesOptions.cursor,
                            Severity: Major
                            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 3 hrs to fix

                              Function htmlUpdateTransform has 88 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  htmlUpdateTransform: function () {
                                      // aligning non added elements is expensive
                                      if (!this.added) {
                                          this.alignOnAdd = true;
                                          return;
                              Severity: Major
                              Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language