Floppy/carbon-diet

View on GitHub
app/assets/javascripts/standard/dragdrop.js

Summary

Maintainability
F
1 wk
Test Coverage

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

// script.aculo.us dragdrop.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010

// Copyright (c) 2005-2010 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 app/assets/javascripts/standard/dragdrop.js - About 1 day to fix

    Function create has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      create: function(element) {
        element = $(element);
        var options = Object.extend({
          element:     element,
          tag:         'li',       // assumes li children, override with tag: 'tagname'
    Severity: Major
    Found in app/assets/javascripts/standard/dragdrop.js - About 3 hrs to fix

      Function finishDrag has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        finishDrag: function(event, success) {
          this.dragging = false;
      
          if(this.options.quiet){
            Position.prepare();
      Severity: Minor
      Found in app/assets/javascripts/standard/dragdrop.js - 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 onEmptyHover has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        onEmptyHover: function(element, dropon, overlap) {
          var oldParentNode = element.parentNode;
          var droponOptions = Sortable.options(dropon);
      
          if(!Element.isParent(dropon, element)) {
      Severity: Minor
      Found in app/assets/javascripts/standard/dragdrop.js - 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 updateDrag has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

        updateDrag: function(event, pointer) {
          if(!this.dragging) this.startDrag(event);
      
          if(!this.options.quiet){
            Position.prepare();
      Severity: Minor
      Found in app/assets/javascripts/standard/dragdrop.js - 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 initialize has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        initialize: function(element) {
          var defaults = {
            handle: false,
            reverteffect: function(element, top_offset, left_offset) {
              var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
      Severity: Minor
      Found in app/assets/javascripts/standard/dragdrop.js - About 2 hrs to fix

        Function draw has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          draw: function(point) {
            var pos = this.element.cumulativeOffset();
            if(this.options.ghosting) {
              var r   = Position.realOffset(this.element);
              pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
        Severity: Minor
        Found in app/assets/javascripts/standard/dragdrop.js - 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 onHover has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          onHover: function(element, dropon, overlap) {
            if(Element.isParent(dropon, element)) return;
        
            if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
              return;
        Severity: Minor
        Found in app/assets/javascripts/standard/dragdrop.js - 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 finishDrag has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          finishDrag: function(event, success) {
            this.dragging = false;
        
            if(this.options.quiet){
              Position.prepare();
        Severity: Minor
        Found in app/assets/javascripts/standard/dragdrop.js - About 1 hr to fix

          Function draw has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            draw: function(point) {
              var pos = this.element.cumulativeOffset();
              if(this.options.ghosting) {
                var r   = Position.realOffset(this.element);
                pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
          Severity: Minor
          Found in app/assets/javascripts/standard/dragdrop.js - About 1 hr to fix

            Function updateDrag has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              updateDrag: function(event, pointer) {
                if(!this.dragging) this.startDrag(event);
            
                if(!this.options.quiet){
                  Position.prepare();
            Severity: Minor
            Found in app/assets/javascripts/standard/dragdrop.js - About 1 hr to fix

              Function scroll has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                scroll: function() {
                  var current = new Date();
                  var delta = current - this.lastScrolled;
                  this.lastScrolled = current;
                  if(this.options.scroll == window) {
              Severity: Minor
              Found in app/assets/javascripts/standard/dragdrop.js - About 1 hr to fix

                Function scroll has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  scroll: function() {
                    var current = new Date();
                    var delta = current - this.lastScrolled;
                    this.lastScrolled = current;
                    if(this.options.scroll == window) {
                Severity: Minor
                Found in app/assets/javascripts/standard/dragdrop.js - 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 startDrag has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  startDrag: function(event) {
                    this.dragging = true;
                    if(!this.delta)
                      this.delta = this.currentDelta();
                
                
                Severity: Minor
                Found in app/assets/javascripts/standard/dragdrop.js - 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 startDrag has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  startDrag: function(event) {
                    this.dragging = true;
                    if(!this.delta)
                      this.delta = this.currentDelta();
                
                
                Severity: Minor
                Found in app/assets/javascripts/standard/dragdrop.js - About 1 hr to fix

                  Function initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    initialize: function(element) {
                      var defaults = {
                        handle: false,
                        reverteffect: function(element, top_offset, left_offset) {
                          var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
                  Severity: Minor
                  Found in app/assets/javascripts/standard/dragdrop.js - About 55 mins 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 show has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    show: function(point, element) {
                      if(!this.drops.length) return;
                      var drop, affected = [];
                  
                      this.drops.each( function(drop) {
                  Severity: Minor
                  Found in app/assets/javascripts/standard/dragdrop.js - About 45 mins 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 _tree has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    _tree: function(element, options, parent) {
                      var children = Sortable.findElements(element, options) || [];
                  
                      for (var i = 0; i < children.length; ++i) {
                        var match = children[i].id.match(options.format);
                  Severity: Minor
                  Found in app/assets/javascripts/standard/dragdrop.js - About 45 mins 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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    create: function(element) {
                      element = $(element);
                      var options = Object.extend({
                        element:     element,
                        tag:         'li',       // assumes li children, override with tag: 'tagname'
                  Severity: Minor
                  Found in app/assets/javascripts/standard/dragdrop.js - About 45 mins 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

                  Consider simplifying this complex logical expression.
                  Open

                        if((tag_name = src.tagName.toUpperCase()) && (
                          tag_name=='INPUT' ||
                          tag_name=='SELECT' ||
                          tag_name=='OPTION' ||
                          tag_name=='BUTTON' ||
                  Severity: Major
                  Found in app/assets/javascripts/standard/dragdrop.js - About 40 mins to fix

                    Function initDrag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      initDrag: function(event) {
                        if(!Object.isUndefined(Draggable._dragging[this.element]) &&
                          Draggable._dragging[this.element]) return;
                        if(Event.isLeftClick(event)) {
                          // abort on form elements, fixes a Firefox issue
                    Severity: Minor
                    Found in app/assets/javascripts/standard/dragdrop.js - About 25 mins 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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      add: function(element) {
                        element = $(element);
                        var options = Object.extend({
                          greedy:     true,
                          hoverclass: null,
                    Severity: Minor
                    Found in app/assets/javascripts/standard/dragdrop.js - About 25 mins 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 _getWindowScroll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      _getWindowScroll: function(w) {
                        var T, L, W, H;
                        with (w.document) {
                          if (w.document.documentElement && documentElement.scrollTop) {
                            T = documentElement.scrollTop;
                    Severity: Minor
                    Found in app/assets/javascripts/standard/dragdrop.js - About 25 mins 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 mark has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      mark: function(dropon, position) {
                        // mark on ghosting only
                        var sortable = Sortable.options(dropon.parentNode);
                        if(sortable && !sortable.ghosting) return;
                    
                    
                    Severity: Minor
                    Found in app/assets/javascripts/standard/dragdrop.js - About 25 mins 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(dropon.previousSibling != element) {
                            var oldParentNode = element.parentNode;
                            element.style.visibility = "hidden"; // fix gecko rendering
                            dropon.parentNode.insertBefore(element, dropon);
                            if(dropon.parentNode!=oldParentNode)
                    Severity: Major
                    Found in app/assets/javascripts/standard/dragdrop.js and 1 other location - About 3 hrs to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 770..777

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

                    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(nextElement != element) {
                            var oldParentNode = element.parentNode;
                            element.style.visibility = "hidden"; // fix gecko rendering
                            dropon.parentNode.insertBefore(element, nextElement);
                            if(dropon.parentNode!=oldParentNode)
                    Severity: Major
                    Found in app/assets/javascripts/standard/dragdrop.js and 1 other location - About 3 hrs to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 759..766

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

                    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

                          if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
                    Severity: Major
                    Found in app/assets/javascripts/standard/dragdrop.js and 3 other locations - About 1 hr to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 384..384
                    app/assets/javascripts/standard/dragdrop.js on lines 385..385
                    app/assets/javascripts/standard/dragdrop.js on lines 387..387

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

                    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

                          if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
                    Severity: Major
                    Found in app/assets/javascripts/standard/dragdrop.js and 3 other locations - About 1 hr to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 384..384
                    app/assets/javascripts/standard/dragdrop.js on lines 386..386
                    app/assets/javascripts/standard/dragdrop.js on lines 387..387

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

                    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

                          if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
                    Severity: Major
                    Found in app/assets/javascripts/standard/dragdrop.js and 3 other locations - About 1 hr to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 385..385
                    app/assets/javascripts/standard/dragdrop.js on lines 386..386
                    app/assets/javascripts/standard/dragdrop.js on lines 387..387

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

                    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

                          if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
                    Severity: Major
                    Found in app/assets/javascripts/standard/dragdrop.js and 3 other locations - About 1 hr to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 384..384
                    app/assets/javascripts/standard/dragdrop.js on lines 385..385
                    app/assets/javascripts/standard/dragdrop.js on lines 386..386

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

                    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.options.constraint) || (this.options.constraint=='horizontal'))
                          style.left = p[0] + "px";
                    Severity: Minor
                    Found in app/assets/javascripts/standard/dragdrop.js and 1 other location - About 40 mins to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 492..493

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

                    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.options.constraint) || (this.options.constraint=='vertical'))
                          style.top  = p[1] + "px";
                    Severity: Minor
                    Found in app/assets/javascripts/standard/dragdrop.js and 1 other location - About 40 mins to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 490..491

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

                    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

                        var options = Object.extend({
                          tag: sortableOptions.tag,
                          treeTag: sortableOptions.treeTag,
                          only: sortableOptions.only,
                          name: element.id,
                    Severity: Minor
                    Found in app/assets/javascripts/standard/dragdrop.js and 1 other location - About 35 mins to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 688..694

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

                    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

                        var options_for_droppable = {
                          overlap:     options.overlap,
                          containment: options.containment,
                          tree:        options.tree,
                          hoverclass:  options.hoverclass,
                    Severity: Minor
                    Found in app/assets/javascripts/standard/dragdrop.js and 1 other location - About 35 mins to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 871..877

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

                    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

                    There are no issues that match your filters.

                    Category
                    Status