concord-consortium/rigse

View on GitHub

Showing 2,106 of 2,108 total issues

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

UI.WindowManager.Stack = Class.create(Enumerable, {
  initialize: function() {
    this.windows = [ ];
  },

Severity: Major
Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 2 other locations - About 2 days to fix
rails/app/assets/javascripts/livepipe/window.js on lines 2925..2972
rails/public/javascripts/light_box.js on lines 4892..4939

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

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

(function() {
  var initPointer, draggedElement;
  
  document.observe('mousedown', function(event) {
    if (draggedElement = findDraggable(event.element())) {
Severity: Major
Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 3 other locations - About 2 days to fix
rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 1941..1996
rails/public/javascripts/light_box.js on lines 1548..1603
rails/public/javascripts/light_box.js on lines 1941..1996

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

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

(function() {
  var initPointer, draggedElement;
  
  document.observe('mousedown', function(event) {
    if (draggedElement = findDraggable(event.element())) {
Severity: Major
Found in rails/public/javascripts/light_box.js and 3 other locations - About 2 days to fix
rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 1548..1603
rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 1941..1996
rails/public/javascripts/light_box.js on lines 1941..1996

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

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

(function() {
  var initPointer, draggedElement;

  document.observe('mousedown', function(event) {
    if (draggedElement = findDraggable(event.element())) {
Severity: Major
Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 3 other locations - About 2 days to fix
rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 1548..1603
rails/public/javascripts/light_box.js on lines 1548..1603
rails/public/javascripts/light_box.js on lines 1941..1996

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

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

(function() {
  var initPointer, draggedElement;

  document.observe('mousedown', function(event) {
    if (draggedElement = findDraggable(event.element())) {
Severity: Major
Found in rails/public/javascripts/light_box.js and 3 other locations - About 2 days to fix
rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 1548..1603
rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 1941..1996
rails/public/javascripts/light_box.js on lines 1548..1603

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

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

    def materials_data( materials,
                        assigned_to_class       = nil,
                        include_related         = 0,
                        skip_lightbox_reloads   = false )
      data = []
Severity: Minor
Found in rails/lib/materials/data_helpers.rb - About 2 days 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

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

Object.extend(Array.prototype, {
  /**
   * Array#isEmpty() -> Boolean
   * Convenient method to check wether or not array is empty
   * returns: true if array is empty, false otherwise
Severity: Major
Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 1 other location - About 2 days to fix
rails/public/javascripts/light_box.js on lines 158..222

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

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

Object.extend(Array.prototype, {
  /**
   * Array#isEmpty() -> Boolean
   * Convenient method to check wether or not array is empty
   * returns: true if array is empty, false otherwise
Severity: Major
Found in rails/public/javascripts/light_box.js and 1 other location - About 2 days to fix
rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 158..222

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

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

Element.addMethods({
  center: function( container, element ) {
    element = $(element);
    container = $(container);
    var cBorders = container.borderDimensions(), eBorders = element.borderDimensions();
Severity: Major
Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 1 other location - About 2 days to fix
rails/public/javascripts/light_box.js on lines 5961..5985

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

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

Element.addMethods({
  center: function( container, element ) {
    element = $(element);
    container = $(container);
    var cBorders = container.borderDimensions(), eBorders = element.borderDimensions();
Severity: Major
Found in rails/public/javascripts/light_box.js and 1 other location - About 2 days to fix
rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 5961..5985

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

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

File controls.js has 804 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009

// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//           (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
//           (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
Severity: Major
Found in rails/app/assets/javascripts/controls.js - About 1 day to fix

    File dragdrop.js has 786 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
    
    // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
    //
    // script.aculo.us is freely distributable under the terms of an MIT-style license.
    Severity: Major
    Found in rails/app/assets/javascripts/dragdrop.js - About 1 day to fix

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

      Element.addMethods({
        getCaretPosition: function(element) {
          if (element.createTextRange) {
            var r = document.selection.createRange().duplicate();
              r.moveEnd('character', element.value.length);
      Severity: Major
      Found in rails/public/javascripts/light_box.js and 1 other location - About 1 day to fix
      rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 5799..5822

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

      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

      Element.addMethods({
        getCaretPosition: function(element) {
          if (element.createTextRange) {
            var r = document.selection.createRange().duplicate();
              r.moveEnd('character', element.value.length);
      Severity: Major
      Found in rails/app/assets/javascripts/prototype-ui/prototype-ui.js and 1 other location - About 1 day to fix
      rails/public/javascripts/light_box.js on lines 5799..5822

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

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

          drawLabels: function(){        
              // Construct fixed width label boxes, which can be styled easily. 
              var noLabels = 0, axis,
                  xBoxWidth, i, html, tick,
                  options = this.options,
      Severity: Minor
      Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 1 day 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 drawLabels has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
      Open

          drawLabels: function(){        
              // Construct fixed width label boxes, which can be styled easily. 
              var noLabels = 0, axis,
                  xBoxWidth, i, html, tick,
                  options = this.options,
      Severity: Minor
      Found in rails/app/assets/javascripts/flotr/flotr.js - About 1 day 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 insertLegend has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
      Open

          insertLegend: function(){
              if(!this.options.legend.show)
                  return;
                  
              var series = this.series,
      Severity: Minor
      Found in rails/app/assets/javascripts/flotr/flotr_out.js - About 1 day 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 insertLegend has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
      Open

          insertLegend: function(){
              if(!this.options.legend.show)
                  return;
                  
              var series = this.series,
      Severity: Minor
      Found in rails/app/assets/javascripts/flotr/flotr.js - About 1 day 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 Element has 355 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      PIE.Element = (function() {
      
          var wrappers = {},
              lazyInitCssProp = PIE.CSS_PREFIX + 'lazy-init',
              pollCssProp = PIE.CSS_PREFIX + 'poll',
      Severity: Major
      Found in rails/app/assets/javascripts/pie/PIE_uncompressed.js - About 1 day to fix

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

          startModalSession: function(win) {
            if (!this.modalSessions) {
              this.removeOverflow();
              this.modalOverlay.className = win.getTheme() + "_overlay";
              this.container.appendChild(this.modalOverlay);
        Severity: Major
        Found in rails/public/javascripts/light_box.js and 1 other location - About 1 day to fix
        rails/app/assets/javascripts/prototype-ui/prototype-ui.js on lines 4684..4702

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

        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