concord-consortium/rigse

View on GitHub

Showing 2,136 of 2,138 total issues

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

    if ((queryCache[cacheKey] != null ? queryCache[cacheKey].then : undefined)) { // already made a Promise that is still pending
      queryCache[cacheKey].then(handleResponse); // chain a new Then
    } else if (queryCache[cacheKey]) { // have data that has already returned
      handleResponse(queryCache[cacheKey]); // use it directly
    } else {
rails/react-components/src/library/components/user-report-form/index.tsx on lines 102..112

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

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 ((queryCache[cacheKey] != null ? queryCache[cacheKey].then : undefined)) { // already made a Promise that is still pending
      queryCache[cacheKey].then(handleResponse); // chain a new Then
    } else if (queryCache[cacheKey]) { // have data that has already returned
      handleResponse(queryCache[cacheKey]); // use it directly
    } else {
rails/react-components/src/library/components/researcher-classes-form/index.tsx on lines 92..102

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

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 constructDataGrid has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    constructDataGrid: function(){
        // If the data grid has already been built, nothing to do here
        if (this.datagrid) return this.datagrid;
        
        var i, j, 
Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 4 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 setOptions has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    setOptions: function(opts){
        var options = {
            colors: ['#00A8F0', '#C0D800', '#CB4B4B', '#4DA74D', '#9440ED'], //=> The default colorscheme. When there are > 5 series, additional colors are generated.
            title: null,
            subtitle: null,
Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 4 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 constructDataGrid has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    constructDataGrid: function(){
        // If the data grid has already been built, nothing to do here
        if (this.datagrid) return this.datagrid;
        
        var i, j, 
Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr.js - About 4 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 setOptions has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    setOptions: function(opts){
        var options = {
            colors: ['#00A8F0', '#C0D800', '#CB4B4B', '#4DA74D', '#9440ED'], //=> The default colorscheme. When there are > 5 series, additional colors are generated.
            title: null,
            subtitle: null,
Severity: Minor
Found in rails/app/assets/javascripts/flotr/flotr.js - About 4 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 import_activity has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def import_activity(activity_json,import_object,imported_activity_url=nil)
    begin
      Timeout.timeout(90) {
        client = Client.where(:site_url => APP_CONFIG[:authoring_site_url]).first!
        auth_token = 'Bearer %s' % client.app_secret
Severity: Minor
Found in rails/app/models/import/import_external_activity.rb - About 4 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 CSS has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

var CSS = (function() {
  // Code based on:
  //   - IE5.5+ PNG Alpha Fix v1.0RC4 (c) 2004-2005 Angus Turnbull http://www.twinhelix.com
  //   - Whatever:hover - V2.02.060206 - hover, active & focus (c) 2005 - Peter Nederlof * Peterned - http://www.xs4all.nl/~peterned/
  function fixPNG() {
Severity: Minor
Found in rails/app/assets/javascripts/livepipe/window.js - About 4 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 drawSeriesPie has 109 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    drawSeriesPie: function(series) {
        if (this.options.pie.drawn) return;
        
        var ctx = this.ctx,
            options = this.options,
Severity: Major
Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 4 hrs to fix

    Function insertLegend has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        insertLegend: function(){
            if(!this.options.legend.show)
                return;
                
            var series = this.series,
    Severity: Major
    Found in rails/app/assets/javascripts/flotr/flotr.js - About 4 hrs to fix

      Function insertLegend has 109 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          insertLegend: function(){
              if(!this.options.legend.show)
                  return;
                  
              var series = this.series,
      Severity: Major
      Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 4 hrs to fix

        Function drawSeriesPie has 109 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            drawSeriesPie: function(series) {
                if (this.options.pie.drawn) return;
                
                var ctx = this.ctx,
                    options = this.options,
        Severity: Major
        Found in rails/app/assets/javascripts/flotr/flotr.js - About 4 hrs to fix

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

            prepareOptions: function() {
              this.options = Object.clone(Ajax.InPlaceRichEditor.DefaultOptions);
              Object.extend(this.options, Ajax.InPlaceRichEditor.DefaultCallbacks);
              [this._extraDefaultOptions].flatten().compact().each(function(defs) {
                Object.extend(this.options, defs);
          rails/app/assets/javascripts/controls.js on lines 693..699

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

          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

            prepareOptions: function() {
              this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions);
              Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks);
              [this._extraDefaultOptions].flatten().compact().each(function(defs) {
                Object.extend(this.options, defs);
          Severity: Major
          Found in rails/app/assets/javascripts/controls.js and 1 other location - About 4 hrs to fix
          rails/app/assets/javascripts/in_place_rich_editor/inplacericheditor.js on lines 168..174

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

          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

          (function() {
            /*
              Method: debug
                Logs with "debug" level
          
          
          Severity: Major
          Found in rails/app/assets/javascripts/livepipe/window.js and 2 other locations - About 4 hrs to fix
          rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 2359..2382
          rails/public/javascripts/light_box.js on lines 2359..2382

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

          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

          (function() {
            /*
              Method: debug
                Logs with "debug" level
          
          
          Severity: Major
          Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 2 other locations - About 4 hrs to fix
          rails/app/assets/javascripts/livepipe/window.js on lines 786..809
          rails/public/javascripts/light_box.js on lines 2359..2382

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

          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

          (function() {
            /*
              Method: debug
                Logs with "debug" level
          
          
          Severity: Major
          Found in rails/public/javascripts/light_box.js and 2 other locations - About 4 hrs to fix
          rails/app/assets/javascripts/livepipe/window.js on lines 786..809
          rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 2359..2382

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

          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

          AutoComplete has 34 functions (exceeds 20 allowed). Consider refactoring.
          Open

          UI.AutoComplete = Class.create(UI.Options, {
            // Group: Options
            options: {
              className: "pui-autocomplete",         // CSS class name prefix
              max: {selection: 10, selected:false},  // Max values fort autocomplete,
          Severity: Minor
          Found in rails/public/javascripts/light_box.js - About 4 hrs to fix

            AutoComplete has 34 functions (exceeds 20 allowed). Consider refactoring.
            Open

            UI.AutoComplete = Class.create(UI.Options, {
              // Group: Options
              options: {
                className: "pui-autocomplete",         // CSS class name prefix
                max: {selection: 10, selected:false},  // Max values fort autocomplete,
            Severity: Minor
            Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js - About 4 hrs to fix

              File report_learners_es_controller.rb has 346 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'digest/md5'
              
              class API::V1::ReportLearnersEsController < API::APIController
              
                class ESError < StandardError
              Severity: Minor
              Found in rails/app/controllers/api/v1/report_learners_es_controller.rb - About 4 hrs to fix
                Severity
                Category
                Status
                Source
                Language