sleepepi/sleepportal

View on GitHub

Showing 332 of 436 total issues

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

        initContainer: function () {

            var selector = ".select2-choices", selection;

            this.searchContainer = this.container.find(".select2-search-field");
Severity: Major
Found in app/assets/javascripts/external/select2.js - About 3 hrs to fix

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

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

      Consider simplifying this complex logical expression.
      Open

              if (
                      // already has this state
                      state === point.state ||
                      // selected points don't respond to hover
                      (point.selected && state !== SELECT_STATE) ||
      Severity: Critical
      Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 3 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                if (optionsLabel && defined(optionsLabel.text) && path && path.length && axis.width > 0 && axis.height > 0) {
                    // apply defaults
                    optionsLabel = merge({
                        align: horiz && isBand && 'center',
                        x: horiz ? !isBand && 4 : 10,
        Severity: Critical
        Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 3 hrs to fix

          Function Color has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var Color = function (input) {
              // declare variables
              var rgba = [], result, stops;
          
              /**
          Severity: Major
          Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

            Function getTimeTicks has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getTimeTicks(normalizedInterval, min, max, startOfWeek) {
                var tickPositions = [],
                    i,
                    higherRanks = {},
                    useUTC = defaultOptions.global.useUTC,
            Severity: Major
            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

              Function getMargins has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  getMargins: function () {
                      var chart = this,
                          spacing = chart.spacing,
                          axisOffset,
                          legend = chart.legend,
              Severity: Major
              Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

                Function clipNeg has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    clipNeg: function () {
                        var options = this.options,
                            chart = this.chart,
                            renderer = chart.renderer,
                            negativeColor = options.negativeColor || options.negativeFillColor,
                Severity: Major
                Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

                  Method generate_report_table has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def generate_report_table(current_user)
                      filtered_report_concepts = self.report_concepts.select{|rc| not rc.position.blank?}
                      values = self.search.view_concept_values(current_user, filtered_report_concepts)
                  
                      row_values = []
                  Severity: Major
                  Found in app/models/report.rb - About 2 hrs to fix

                    Function getLogTickPositions has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        getLogTickPositions: function (interval, min, max, minor) {
                            var axis = this,
                                options = axis.options,
                                axisLength = axis.len,
                                // Since we use this method for both major and minor ticks,
                    Severity: Major
                    Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

                      Function addPoint has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          addPoint: function (options, redraw, shift, animation) {
                              var series = this,
                                  seriesOptions = series.options,
                                  data = series.data,
                                  graph = series.graph,
                      Severity: Major
                      Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

                        Function addLabel has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            addLabel: function () {
                                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 2 hrs to fix

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

                            def graph_values(current_user)
                              categories = []
                              values = self.all_values_for_column(current_user)[:values]
                          
                              case self.variable.variable_type when 'numeric', 'integer'
                          Severity: Minor
                          Found in app/models/mapping.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 init has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  init: function (opts) {
                                      var results, search, resultsSelector = ".select2-results";
                          
                                      // prepare options
                                      this.opts = opts = this.prepareOpts(opts);
                          Severity: Major
                          Found in app/assets/javascripts/external/select2.js - About 2 hrs to fix

                            Function setState has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                setState: function (state) {
                                    var point = this,
                                        plotX = point.plotX,
                                        plotY = point.plotY,
                                        series = point.series,
                            Severity: Major
                            Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix

                              Function sparkline has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  $.fn.sparkline = function (userValues, userOptions) {
                                      return this.each(function () {
                                          var options = new $.fn.sparkline.options(this, userOptions),
                                               $this = $(this),
                                               render, i;
                              Severity: Major
                              Found in app/assets/javascripts/external/jquery.sparkline.js - About 2 hrs to fix

                                Function updateResults has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        updateResults: function (initial) {
                                            var search = this.search, results = this.results, opts = this.opts, data, self=this, input;
                                
                                            // if the search is currently hidden we do not alter the results
                                            if (initial !== true && (this.showSearchInput === false || !this.opened())) {
                                Severity: Major
                                Found in app/assets/javascripts/external/select2.js - About 2 hrs to fix

                                  Method import_variables has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def import_variables(file_name)
                                      version = Time.now.to_i.to_s
                                  
                                      CSV.parse( File.open(file_name, 'r:iso-8859-1:utf-8'){|f| f.read}, headers: true ) do |line|
                                        row = line.to_hash
                                  Severity: Minor
                                  Found in app/models/dictionary.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 update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def update
                                      @criterium = @search.criteria.find_by_id(params[:id])
                                      if @criterium
                                        params[:criterium] = {} if params[:criterium].blank?
                                        params[:criterium][:right_operator] = 'and' unless Criterium::OPERATOR.include?(params[:criterium][:right_operator])
                                  Severity: Minor
                                  Found in app/controllers/criteria_controller.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 drag has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      drag: function (e) {
                                  
                                          var chart = this.chart,
                                              chartOptions = chart.options.chart,
                                              chartX = e.chartX,
                                  Severity: Major
                                  Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language