sleepepi/sleepportal

View on GitHub

Showing 436 of 436 total issues

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

                    if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e) || e.which === KEY.ESC) {
                        return;
                    }
Severity: Major
Found in app/assets/javascripts/external/select2.js and 1 other location - About 1 hr to fix
app/assets/javascripts/external/select2.js on lines 1525..1528

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

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 (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
                 || e.which === KEY.ESC) {
                    return;
                }
Severity: Major
Found in app/assets/javascripts/external/select2.js and 1 other location - About 1 hr to fix
app/assets/javascripts/external/select2.js on lines 1463..1465

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

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 (defined(userOptions._symbolIndex)) { // after Series.update()
                symbolIndex = userOptions._symbolIndex;
            } else {
                userOptions._symbolIndex = counters.symbol;
                symbolIndex = counters.symbol++;
Severity: Major
Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 1 hr to fix
app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 12988..12993

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

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

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

  def join_conditions(tables, current_user)
    result = []
    errors = []
    result_hash = self.sql_codes(current_user)
    sql_open = result_hash[:open]
Severity: Minor
Found in app/models/source.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

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

            if (defined(userOptions._colorIndex)) { // after Series.update()
                colorIndex = userOptions._colorIndex;
            } else {
                userOptions._colorIndex = counters.color;
                colorIndex = counters.color++;
Severity: Major
Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 1 hr to fix
app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 13014..13019

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

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

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

  def human_value
    case self.variable.variable_type when 'integer', 'numeric'
      token_ranges
    when 'choices'
      self.variable.domain.options.select{|option| self.value.to_s.split(',').include?(option[:value].to_s)}.collect{|option| option[:display_name]}.join(' <span class="nolink">or</span> ').html_safe
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

Function getSegments has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getSegments: function () {
        var series = this,
            lastNull = -1,
            segments = [],
            i,
Severity: Minor
Found in app/assets/javascripts/external/highcharts-3.0.7.src.js - About 1 hr to fix

    Function ajax has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function ajax(options) {
            var timeout, // current scheduled but not yet executed request
                requestSequence = 0, // sequence used to drop out-of-order responses
                handler = null,
                quietMillis = options.quietMillis || 100;
    Severity: Minor
    Found in app/assets/javascripts/external/select2.js - About 1 hr to fix

      Function populateResults has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      populateResults: function(container, results, query) {
                          var populate,  data, result, children, id=this.opts.id, self=this;
      
                          populate=function(results, container, depth) {
      
      
      Severity: Minor
      Found in app/assets/javascripts/external/select2.js - About 1 hr to fix

        Function defaultTokenizer has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function defaultTokenizer(input, selection, selectCallback, opts) {
                var original = input, // store the original so we can compare and know if we need to tell the search to update its text
                    dupe = false, // check for whether a token we extracted represents a duplicate selected choice
                    token, // token
                    index, // position at which the separator was found
        Severity: Minor
        Found in app/assets/javascripts/external/select2.js - About 1 hr to fix

          Method create_matches has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def create_matches(include_extra)
                @matches = []
                cases_matrix = []
                controls_matrix = []
          
          
          Severity: Minor
          Found in app/controllers/matching_controller.rb - About 1 hr to fix

            Function opening has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    opening: function() {
                        var cid = this.containerId, selector = this.containerSelector,
                            scroll = "scroll." + cid, resize = "resize." + cid;
            
                        this.container.parents().each(function() {
            Severity: Minor
            Found in app/assets/javascripts/external/select2.js - About 1 hr to fix

              Function loadMoreIfNeeded has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      loadMoreIfNeeded: function () {
                          var results = this.results,
                              more = results.find("li.select2-more-results"),
                              below, // pixels the element is below the scroll fold, below==0 is when the element is starting to be visible
                              offset = -1, // index of first element without data
              Severity: Minor
              Found in app/assets/javascripts/external/select2.js - About 1 hr to fix

                Function addSelectedChoice has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        addSelectedChoice: function (data) {
                            var choice=$(
                                    "<li class='select2-search-choice'>" +
                                    "    <div></div>" +
                                    "    <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a>" +
                Severity: Minor
                Found in app/assets/javascripts/external/select2.js - About 1 hr to fix

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

                          for (i = 0; i < series.length; i++) {
                              if (series[i].options.id === id) {
                                  return series[i];
                              }
                          }
                  Severity: Major
                  Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 11010..11014

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

                  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

                          for (i = 0; i < axes.length; i++) {
                              if (axes[i].options.id === id) {
                                  return axes[i];
                              }
                          }
                  Severity: Major
                  Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 11017..11021

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

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

                              if (this.targetX !== undefined && this.targetY !== undefined &&
                                  context.isPointInPath(this.targetX, this.targetY)) {
                                  this.currentTargetShapeId = shapeid;
                              }
                  Severity: Major
                  Found in app/assets/javascripts/external/jquery.sparkline.js and 2 other locations - About 1 hr to fix
                  app/assets/javascripts/external/jquery.sparkline.js on lines 2743..2746
                  app/assets/javascripts/external/jquery.sparkline.js on lines 2778..2781

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

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

                              if (this.targetX !== undefined && this.targetY !== undefined &&
                                  context.isPointInPath(this.targetX, this.targetY)) {
                                  this.currentTargetShapeId = shapeid;
                              }
                  Severity: Major
                  Found in app/assets/javascripts/external/jquery.sparkline.js and 2 other locations - About 1 hr to fix
                  app/assets/javascripts/external/jquery.sparkline.js on lines 2743..2746
                  app/assets/javascripts/external/jquery.sparkline.js on lines 2753..2756

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

                  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

                          } else if (axis.horiz) {
                              y1 = axisTop;
                              y2 = cHeight - axis.bottom;
                              if (x1 < axisLeft || x1 > axisLeft + axis.width) {
                                  skip = true;
                  Severity: Major
                  Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 7119..7126

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

                  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 (off < 0) {
                              if (align === 'right') {
                                  options.align = 'left';
                              } else {
                                  options.x = -off;
                  Severity: Major
                  Found in app/assets/javascripts/external/highcharts-3.0.7.src.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/external/highcharts-3.0.7.src.js on lines 14606..14613

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language