sleepepi/sleepportal

View on GitHub

Showing 436 of 436 total issues

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

            if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > max)) {
                max = options.get('chartRangeMax');
            }
Severity: Major
Found in app/assets/javascripts/external/jquery.sparkline.js and 1 other location - About 1 hr to fix
app/assets/javascripts/external/jquery.sparkline.js on lines 1774..1776

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

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

Consider simplifying this complex logical expression.
Open

if (!hasSVG && !useCanVG) {

/**
 * The VML element wrapper.
 */
Severity: Critical
Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

    Function getMinorTickPositions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        getMinorTickPositions: function () {
            var axis = this,
                options = axis.options,
                tickPositions = axis.tickPositions,
                minorTickInterval = axis.minorTickInterval,
    Severity: Minor
    Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

      Function colorizeItem has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          colorizeItem: function (item, visible) {
              var legend = this,
                  options = legend.options,
                  legendItem = item.legendItem,
                  legendLine = item.legendLine,
      Severity: Minor
      Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

        Function format has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function format(str, ctx) {
            var splitter = '{',
                isInside = false,
                segment,
                valueAndFormat,
        Severity: Minor
        Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

          Function getPlotLinePath has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getPlotLinePath: function (value, lineWidth, old, force) {
                  var axis = this,
                      chart = axis.chart,
                      axisLeft = axis.left,
                      axisTop = axis.top,
          Severity: Minor
          Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

            Function initContainerWidth has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    initContainerWidth: function () {
                        function resolveContainerWidth() {
                            var style, attrs, matches, i, l;
            
                            if (this.opts.width === "off") {
            Severity: Minor
            Found in app/assets/javascripts/external/select2.js - About 1 hr to fix

              Function _drawPieSlice has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _drawPieSlice: function (shapeid, x, y, radius, startAngle, endAngle, lineColor, fillColor) {
                          var vpath, startx, starty, endx, endy, stroke, fill, vel;
                          if (startAngle === endAngle) {
                              return '';  // VML seems to have problem when start angle equals end angle.
                          }
              Severity: Minor
              Found in app/assets/javascripts/external/jquery.sparkline.js - About 1 hr to fix

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

                        if (interval >= timeUnits[HOUR]) { // hour
                            minDate[setHours](interval >= timeUnits[DAY] ? 0 :
                                count * mathFloor(minDate[getHours]() / count));
                        }
                Severity: Major
                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 727..730
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 737..740

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

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

                            } else if (verticalAlign === 'top') {
                                if (!defined(margin[0])) {
                                    chart.plotTop = mathMax(
                                        chart.plotTop,
                                        legend.legendHeight + legendY + legendMargin + spacing[0]
                Severity: Major
                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 11491..11514
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 11507..11514

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

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

                        if (interval >= timeUnits[MINUTE]) { // minute
                            minDate[setMinutes](interval >= timeUnits[HOUR] ? 0 :
                                count * mathFloor(minDate[getMinutes]() / count));
                        }
                Severity: Major
                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 732..735
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 737..740

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

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

                            } else if (verticalAlign === 'bottom') {
                                if (!defined(margin[2])) {
                                    chart.marginBottom = mathMax(
                                        chart.marginBottom,
                                        legend.legendHeight - legendY + legendMargin + spacing[2]
                Severity: Major
                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 11491..11514
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 11499..11514

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

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

                        if (interval >= timeUnits[DAY]) { // day
                            minDate[setDate](interval >= timeUnits[MONTH] ? 1 :
                                count * mathFloor(minDate[getDate]() / count));
                        }
                Severity: Major
                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 727..730
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 732..735

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

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

                            } else if (align === 'left') {
                                if (!defined(margin[3])) {
                                    chart.plotLeft = mathMax(
                                        chart.plotLeft,
                                        legend.legendWidth + legendX + legendMargin + spacing[3]
                Severity: Major
                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 11499..11514
                app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 11507..11514

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

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

                    zoom: function (event) {
                        var chart = this,
                            hasZoomed,
                            pointer = chart.pointer,
                            displayButton = false,
                Severity: Minor
                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

                  Function fireEvent has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          fireEvent: function (el, type, eventArguments, defaultFunction) {
                              var event = $.Event(type),
                                  detachedType = 'detached' + type,
                                  defaultPrevented;
                      
                  Severity: Minor
                  Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

                    Function optionsToObject has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        optionsToObject: function (options) {
                            var ret = {},
                                series = this.series,
                                pointArrayMap = series.pointArrayMap || ['y'],
                                valueCount = pointArrayMap.length,
                    Severity: Minor
                    Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

                      Function defaultLabelFormatter has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          defaultLabelFormatter: function () {
                              var axis = this.axis,
                                  value = this.value,
                                  categories = axis.categories, 
                                  dateTimeLabelFormat = this.dateTimeLabelFormat,
                      Severity: Minor
                      Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

                        Method update_brackets! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def update_brackets!
                            current_level = 0
                            current_offset = 0
                            previous_criterium = nil
                            previous_operator = self.criteria.first ? self.criteria.first.right_operator : nil
                        Severity: Minor
                        Found in app/models/search.rb - About 1 hr 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 find_tokens has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def find_tokens(val)
                            token = '='
                            if token_match = val.to_s.strip.match(/^<=|^>=|^<|^>|^=/)
                              token = token_match[0]
                              val = val.to_s.strip.sub(token, '') # First instance only
                        Severity: Minor
                        Found in app/models/criterium.rb - About 1 hr 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