sleepepi/sleepportal

View on GitHub

Showing 436 of 436 total issues

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

    drawTracker: function () {
        var series = this,
            options = series.options,
            trackByArea = options.trackByArea,
            trackerPath = [].concat(trackByArea ? series.areaPath : series.graphPath),
Severity: Major
Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

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

        init: function (chart, userOptions) {
                
            
            var isXAxis = userOptions.isX,
                axis = this;
    Severity: Major
    Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

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

          getPointSpline: function (segment, point, i) {
              var smoothing = 1.5, // 1 means control points midway between points, 2 means 1/3 from the point, 3 is 1/4 etc
                  denom = smoothing + 1,
                  plotX = point.plotX,
                  plotY = point.plotY,
      Severity: Major
      Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

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

          def graph_values(current_user)
            categories = []
            mapping_values = []
        
            if ['numeric', 'integer', 'date', 'choices'].include?(self.variable_type)
        Severity: Minor
        Found in app/models/variable.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 renderRegion has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                renderRegion: function (valuenum, highlight) {
                    var vals = this.values[valuenum],
                        options = this.options,
                        xaxisOffset = this.xaxisOffset,
                        result = [],
        Severity: Major
        Found in app/assets/javascripts/external/jquery.sparkline.js - About 2 hrs to fix

          Function pinchTranslateDirection has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              pinchTranslateDirection: function (horiz, pinchDown, touches, transform, selectionMarker, clip, lastValidTouch, forcedScale) {
                  var chart = this.chart,
                      xy = horiz ? 'x' : 'y',
                      XY = horiz ? 'X' : 'Y',
                      sChartXY = 'chart' + XY,
          Severity: Major
          Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

            Function normalizeTimeTickInterval has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function normalizeTimeTickInterval(tickInterval, unitsOption) {
                var units = unitsOption || [[
                            MILLISECOND, // unit name
                            [1, 2, 5, 10, 20, 25, 50, 100, 200, 500] // allowed multiples
                        ], [
            Severity: Major
            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

              Method generate_sql_as_normal has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def generate_sql_as_normal(thesource)
                    result = "1 = 0"
              
                    result_hash = thesource.sql_codes(current_user)
                    sql_text = result_hash[:text]
              Severity: Major
              Found in app/models/resolver.rb - About 2 hrs to fix

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

                            if (this.values[0] !== null) {
                                shape = this.renderTarget().append();
                                this.shapes[shape.id] = 't0';
                                this.valueShapes.t0 = shape.id;
                            }
                Severity: Major
                Found in app/assets/javascripts/external/jquery.sparkline.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/external/jquery.sparkline.js on lines 2216..2220

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

                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.values[1] !== null) {
                                shape = this.renderPerformance().append();
                                this.shapes[shape.id] = 'p1';
                                this.valueShapes.p1 = shape.id;
                            }
                Severity: Major
                Found in app/assets/javascripts/external/jquery.sparkline.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/external/jquery.sparkline.js on lines 2221..2225

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

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

                    getSegments: function () {
                        var segments = [],
                            segment = [],
                            keys = [],
                            xAxis = this.xAxis,
                Severity: Major
                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

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

                      getContainer: function () {
                          var chart = this,
                              container,
                              optionsChart = chart.options.chart,
                              chartWidth,
                  Severity: Major
                  Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

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

                      def directional_do!(position, direction)
                        current_position = self.history_position + position
                        if current_position >= 0 and current_position < self.history.size
                          history_hash = self.history[current_position].symbolize_keys
                          qc = Criterium.find_by_id(history_hash[:id])
                    Severity: Minor
                    Found in app/models/search.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 pinch has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        pinch: function (e) {
                    
                            var self = this,
                                chart = self.chart,
                                pinchDown = self.pinchDown,
                    Severity: Major
                    Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

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

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

                        Function adjustForMinRange has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            adjustForMinRange: function () {
                                var axis = this,
                                    options = axis.options,
                                    min = axis.min,
                                    max = axis.max,
                        Severity: Major
                        Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

                          Function getColumnMetrics has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

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

                            Function setChartSize has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                setChartSize: function (skipAxes) {
                                    var chart = this,
                                        inverted = chart.inverted,
                                        renderer = chart.renderer,
                                        chartWidth = chart.chartWidth,
                            Severity: Minor
                            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

                              Function setAxisTranslation has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  setAxisTranslation: function (saveOld) {
                                      var axis = this,
                                          range = axis.max - axis.min,
                                          pointRange = 0,
                                          closestPointRange,
                              Severity: Minor
                              Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

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

                                    init: function (elem, fromD, toD) {
                                        fromD = fromD || '';
                                        var shift = elem.shift,
                                            bezier = fromD.indexOf('C') > -1,
                                            numParams = bezier ? 7 : 3,
                                Severity: Minor
                                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language