thiagopradi/octopus

View on GitHub
sample_app/public/javascripts/prototype.js

Summary

Maintainability
F
1 mo
Test Coverage

File prototype.js has 4031 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*  Prototype JavaScript framework, version 1.6.1
 *  (c) 2005-2009 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
Severity: Major
Found in sample_app/public/javascripts/prototype.js - About 1 wk to fix

    Function id has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
    Open

        id: function(nodes, root, id, combinator) {
          var targetNode = $(id), h = Selector.handlers;
    
          if (root == document) {
            if (!targetNode) return [];
    Severity: Minor
    Found in sample_app/public/javascripts/prototype.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 Enumerable has 209 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var Enumerable = (function() {
      function each(iterator, context) {
        var index = 0;
        try {
          this._each(function(value) {
    Severity: Major
    Found in sample_app/public/javascripts/prototype.js - About 1 day to fix

      Methods has 56 functions (exceeds 20 allowed). Consider refactoring.
      Open

      Element.Methods = {
        visible: function(element) {
          return $(element).style.display != 'none';
        },
      
      
      Severity: Major
      Found in sample_app/public/javascripts/prototype.js - About 1 day to fix

        Function addMethods has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

        Element.addMethods = function(methods) {
          var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
        
          if (!methods) {
            Object.extend(Form, Form.Methods);
        Severity: Minor
        Found in sample_app/public/javascripts/prototype.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 update has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

          update: (function(){
        
            var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
              var el = document.createElement("select"),
                  isBuggy = true;
        Severity: Minor
        Found in sample_app/public/javascripts/prototype.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 nth has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            nth: function(nodes, formula, root, reverse, ofType) {
              if (nodes.length == 0) return [];
              if (formula == 'even') formula = '2n+0';
              if (formula == 'odd')  formula = '2n+1';
              var h = Selector.handlers, results = [], indexed = [], m;
        Severity: Minor
        Found in sample_app/public/javascripts/prototype.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 Hash has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var Hash = Class.create(Enumerable, (function() {
          function initialize(object) {
            this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
          }
        
        
        Severity: Major
        Found in sample_app/public/javascripts/prototype.js - About 3 hrs to fix

          Function serializeElements has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

            serializeElements: function(elements, options) {
              if (typeof options != 'object') options = { hash: !!options };
              else if (Object.isUndefined(options.hash)) options.hash = true;
              var key, value, submitted = false, submit = options.submit;
          
          
          Severity: Minor
          Found in sample_app/public/javascripts/prototype.js - About 3 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 getStyle has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

            Element.Methods.getStyle = function(element, style) {
              element = $(element);
              style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
              var value = element.style[style];
              if (!value && element.currentStyle) value = element.currentStyle[style];
          Severity: Minor
          Found in sample_app/public/javascripts/prototype.js - About 3 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 addMethods has 76 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Element.addMethods = function(methods) {
            var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
          
            if (!methods) {
              Object.extend(Form, Form.Methods);
          Severity: Major
          Found in sample_app/public/javascripts/prototype.js - About 3 hrs to fix

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

              Element._attributeTranslations = (function(){
            
                var classProp = 'className';
                var forProp = 'for';
            
            
            Severity: Major
            Found in sample_app/public/javascripts/prototype.js - About 3 hrs to fix

              Function Class has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              var Class = (function() {
                function subclass() {};
                function create() {
                  var parent = null, properties = $A(arguments);
                  if (Object.isFunction(properties[0]))
              Severity: Minor
              Found in sample_app/public/javascripts/prototype.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 Enumerable has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              var Enumerable = (function() {
                function each(iterator, context) {
                  var index = 0;
                  try {
                    this._each(function(value) {
              Severity: Minor
              Found in sample_app/public/javascripts/prototype.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 update has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                update: (function(){
              
                  var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
                    var el = document.createElement("select"),
                        isBuggy = true;
              Severity: Major
              Found in sample_app/public/javascripts/prototype.js - About 2 hrs to fix

                Function _attributeTranslations has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                  Element._attributeTranslations = (function(){
                
                    var classProp = 'className';
                    var forProp = 'for';
                
                
                Severity: Minor
                Found in sample_app/public/javascripts/prototype.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 extend has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                Element.extend = (function() {
                
                  function checkDeficiency(tagName) {
                    if (typeof window.Element != 'undefined') {
                      var proto = window.Element.prototype;
                Severity: Minor
                Found in sample_app/public/javascripts/prototype.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 tagName has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    tagName: function(nodes, root, tagName, combinator) {
                      var uTagName = tagName.toUpperCase();
                      var results = [], h = Selector.handlers;
                      if (nodes) {
                        if (combinator) {
                Severity: Minor
                Found in sample_app/public/javascripts/prototype.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 extend has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Element.extend = (function() {
                
                  function checkDeficiency(tagName) {
                    if (typeof window.Element != 'undefined') {
                      var proto = window.Element.prototype;
                Severity: Major
                Found in sample_app/public/javascripts/prototype.js - About 2 hrs to fix

                  Function Class has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var Class = (function() {
                    function subclass() {};
                    function create() {
                      var parent = null, properties = $A(arguments);
                      if (Object.isFunction(properties[0]))
                  Severity: Major
                  Found in sample_app/public/javascripts/prototype.js - About 2 hrs to fix

                    Function index has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        index: function(parentNode, reverse, ofType) {
                          parentNode._countedByPrototype = Prototype.emptyFunction;
                          if (reverse) {
                            for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
                              var node = nodes[i];
                    Severity: Minor
                    Found in sample_app/public/javascripts/prototype.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 insert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                      insert: function(element, insertions) {
                        element = $(element);
                    
                        if (Object.isString(insertions) || Object.isNumber(insertions) ||
                            Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
                    Severity: Minor
                    Found in sample_app/public/javascripts/prototype.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 match has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                      match: function(element) {
                        this.tokens = [];
                    
                        var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
                        var le, p, m, len = ps.length, name;
                    Severity: Minor
                    Found in sample_app/public/javascripts/prototype.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 setOpacity has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                      Element.Methods.setOpacity = function(element, value) {
                        element = $(element);
                        element.style.opacity = (value == 1 || value === '') ? '' :
                          (value < 0.00001) ? 0 : value;
                    
                    
                    Severity: Minor
                    Found in sample_app/public/javascripts/prototype.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 getStyle has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        function(proceed, element, style) {
                          switch (style) {
                            case 'left': case 'top': case 'right': case 'bottom':
                              if (proceed(element, 'position') === 'static') return null;
                            case 'height': case 'width':
                    Severity: Minor
                    Found in sample_app/public/javascripts/prototype.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 _createResponder has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function _createResponder(element, eventName, handler) {
                        var registry = Element.retrieve(element, 'prototype_event_registry');
                    
                        if (Object.isUndefined(registry)) {
                          CACHE.push(element);
                    Severity: Minor
                    Found in sample_app/public/javascripts/prototype.js - About 1 hr to fix

                      Function request has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                        request: function(url) {
                          this.url = url;
                          this.method = this.options.method;
                          var params = Object.clone(this.options.parameters);
                      
                      
                      Severity: Minor
                      Found in sample_app/public/javascripts/prototype.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 getElementsByClassName has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                      if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
                        function iter(name) {
                          return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
                        }
                      
                      
                      Severity: Minor
                      Found in sample_app/public/javascripts/prototype.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 select has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        select: function(element, value) {
                          if (Object.isUndefined(value))
                            return this[element.type == 'select-one' ?
                              'selectOne' : 'selectMany'](element);
                          else {
                      Severity: Minor
                      Found in sample_app/public/javascripts/prototype.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 setRequestHeaders has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        setRequestHeaders: function() {
                          var headers = {
                            'X-Requested-With': 'XMLHttpRequest',
                            'X-Prototype-Version': Prototype.Version,
                            'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
                      Severity: Minor
                      Found in sample_app/public/javascripts/prototype.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 setStyle has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                        setStyle: function(element, styles) {
                          element = $(element);
                          var elementStyle = element.style, match;
                          if (Object.isString(styles)) {
                            element.style.cssText += ';' + styles;
                      Severity: Minor
                      Found in sample_app/public/javascripts/prototype.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 stopObserving has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function stopObserving(element, eventName, handler) {
                          element = $(element);
                      
                          var registry = Element.retrieve(element, 'prototype_event_registry');
                      
                      
                      Severity: Minor
                      Found in sample_app/public/javascripts/prototype.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
                                    submit !== false && (!submit || key == submit) && (submitted = true)))) {
                                  if (key in result) {
                                    if (!Object.isArray(result[key])) result[key] = [result[key]];
                                    result[key].push(value);
                        Severity: Critical
                        Found in sample_app/public/javascripts/prototype.js - About 1 hr to fix

                          Function not has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                                'not': function(m) {
                                  var e = m[6], p = Selector.patterns,
                                      x = Selector.xpath, le, v, len = p.length, name;
                          
                                  var exclusion = [];
                          Severity: Minor
                          Found in sample_app/public/javascripts/prototype.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 viewportOffset has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            viewportOffset: function(forElement) {
                              var valueT = 0, valueL = 0;
                          
                              var element = forElement;
                              do {
                          Severity: Minor
                          Found in sample_app/public/javascripts/prototype.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 setOpacity has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            Element.Methods.setOpacity = function(element, value) {
                              function stripAlpha(filter){
                                return filter.replace(/alpha\([^\)]*\)/gi,'');
                              }
                              element = $(element);
                          Severity: Minor
                          Found in sample_app/public/javascripts/prototype.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 respondToReadyState has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            respondToReadyState: function(readyState) {
                              var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
                          
                              if (state == 'Complete') {
                                try {
                          Severity: Minor
                          Found in sample_app/public/javascripts/prototype.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 compileXPathMatcher has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            compileXPathMatcher: function() {
                              var e = this.expression, ps = Selector.patterns,
                                  x = Selector.xpath, le, m, len = ps.length, name;
                          
                              if (Selector._cache[e]) {
                          Severity: Minor
                          Found in sample_app/public/javascripts/prototype.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 compileMatcher has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            compileMatcher: function() {
                              var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
                                  c = Selector.criteria, le, p, m, len = ps.length, name;
                          
                              if (Selector._cache[e]) {
                          Severity: Minor
                          Found in sample_app/public/javascripts/prototype.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 id has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              id: function(nodes, root, id, combinator) {
                                var targetNode = $(id), h = Selector.handlers;
                          
                                if (root == document) {
                                  if (!targetNode) return [];
                          Severity: Minor
                          Found in sample_app/public/javascripts/prototype.js - About 1 hr to fix

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

                              request: function(url) {
                                this.url = url;
                                this.method = this.options.method;
                                var params = Object.clone(this.options.parameters);
                            
                            
                            Severity: Minor
                            Found in sample_app/public/javascripts/prototype.js - About 1 hr to fix

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

                                  function update(element, content) {
                                    element = $(element);
                              
                                    if (content && content.toElement)
                                      content = content.toElement();
                              Severity: Minor
                              Found in sample_app/public/javascripts/prototype.js - About 1 hr to fix

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

                                    nth: function(nodes, formula, root, reverse, ofType) {
                                      if (nodes.length == 0) return [];
                                      if (formula == 'even') formula = '2n+0';
                                      if (formula == 'odd')  formula = '2n+1';
                                      var h = Selector.handlers, results = [], indexed = [], m;
                                Severity: Minor
                                Found in sample_app/public/javascripts/prototype.js - About 1 hr to fix

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

                                    readAttribute: function(element, name) {
                                      element = $(element);
                                      if (Prototype.Browser.IE) {
                                        var t = Element._attributeTranslations.read;
                                        if (t.values[name]) return t.values[name](element, name);
                                  Severity: Minor
                                  Found in sample_app/public/javascripts/prototype.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 replace has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    Element.Methods.replace = function(element, content) {
                                      element = $(element);
                                  
                                      if (content && content.toElement) content = content.toElement();
                                      if (Object.isElement(content)) {
                                  Severity: Minor
                                  Found in sample_app/public/javascripts/prototype.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 nth has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                        nth: function(fragment, m) {
                                          var mm, formula = m[6], predicate;
                                          if (formula == 'even') formula = '2n+0';
                                          if (formula == 'odd')  formula = '2n+1';
                                          if (mm = formula.match(/^(\d+)$/)) // digit only
                                  Severity: Minor
                                  Found in sample_app/public/javascripts/prototype.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 cumulativeOffset has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    Element.Methods.cumulativeOffset = function(element) {
                                      var valueT = 0, valueL = 0;
                                      do {
                                        valueT += element.offsetTop  || 0;
                                        valueL += element.offsetLeft || 0;
                                  Severity: Minor
                                  Found in sample_app/public/javascripts/prototype.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 clonePosition has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    clonePosition: function(element, source) {
                                      var options = Object.extend({
                                        setLeft:    true,
                                        setTop:     true,
                                        setWidth:   true,
                                  Severity: Minor
                                  Found in sample_app/public/javascripts/prototype.js - About 1 hr to fix

                                    Function getElementsByClassName has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
                                      function iter(name) {
                                        return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
                                      }
                                    
                                    
                                    Severity: Minor
                                    Found in sample_app/public/javascripts/prototype.js - About 1 hr to fix

                                      Function match has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        match: function(element) {
                                          this.tokens = [];
                                      
                                          var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
                                          var le, p, m, len = ps.length, name;
                                      Severity: Minor
                                      Found in sample_app/public/javascripts/prototype.js - About 1 hr to fix

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

                                        var Hash = Class.create(Enumerable, (function() {
                                          function initialize(object) {
                                            this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
                                          }
                                        
                                        
                                        Severity: Minor
                                        Found in sample_app/public/javascripts/prototype.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 positionedOffset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                          positionedOffset: function(element) {
                                            var valueT = 0, valueL = 0;
                                            do {
                                              valueT += element.offsetTop  || 0;
                                              valueL += element.offsetLeft || 0;
                                        Severity: Minor
                                        Found in sample_app/public/javascripts/prototype.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 getStyle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                          getStyle: function(element, style) {
                                            element = $(element);
                                            style = style == 'float' ? 'cssFloat' : style.camelize();
                                            var value = element.style[style];
                                            if (!value || value == 'auto') {
                                        Severity: Minor
                                        Found in sample_app/public/javascripts/prototype.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 writeAttribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                          writeAttribute: function(element, name, value) {
                                            element = $(element);
                                            var attributes = { }, t = Element._attributeTranslations.write;
                                        
                                            if (typeof name == 'object') attributes = name;
                                        Severity: Minor
                                        Found in sample_app/public/javascripts/prototype.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 setOpacity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                          Element.Methods.setOpacity = function(element, value) {
                                            element = $(element);
                                            element.style.opacity = (value == 1) ? 0.999999 :
                                              (value === '') ? '' : (value < 0.00001) ? 0 : value;
                                            return element;
                                        Severity: Minor
                                        Found in sample_app/public/javascripts/prototype.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

                                        Avoid deeply nested control flow statements.
                                        Open

                                                if (value[1]) return parseFloat(value[1]) / 100;
                                        Severity: Major
                                        Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                if(element.tagName.toUpperCase() == 'IMG' && element.width) {
                                                  element.width++; element.width--;
                                                } else try {
                                                  var n = document.createTextNode(' ');
                                                  element.appendChild(n);
                                          Severity: Major
                                          Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                        if (node.nodeIndex == indices[j]) results.push(node);
                                            Severity: Major
                                            Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

                                              Function updateContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                updateContent: function(responseText) {
                                                  var receiver = this.container[this.success() ? 'success' : 'failure'],
                                                      options = this.options;
                                              
                                                  if (!options.evalScripts) responseText = responseText.stripScripts();
                                              Severity: Minor
                                              Found in sample_app/public/javascripts/prototype.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

                                              Avoid deeply nested control flow statements.
                                              Open

                                                              if (!attribute) return null;
                                              Severity: Major
                                              Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                              if (targetNode.parentNode == node) return [targetNode];
                                                Severity: Major
                                                Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                        if (element.offsetParent == document.body)
                                                          if (Element.getStyle(element, 'position') == 'absolute') break;
                                                  Severity: Major
                                                  Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                for (var i = 0, node; node = nodes[i]; i++)
                                                                  if (Element.descendantOf(targetNode, node)) return [targetNode];
                                                    Severity: Major
                                                    Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                } else if (combinator == 'adjacent') {
                                                                  for (var i = 0, node; node = nodes[i]; i++)
                                                                    if (Selector.handlers.previousElementSibling(targetNode) == node)
                                                                      return [targetNode];
                                                                } else nodes = h[combinator](nodes);
                                                      Severity: Major
                                                      Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                                  if (node.tagName !== "!") // Filter out comment nodes.
                                                                    results.push(node);
                                                        Severity: Major
                                                        Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

                                                          Function attr has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                          Open

                                                              attr: function(nodes, root, attr, value, operator, combinator) {
                                                          Severity: Minor
                                                          Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

                                                            Consider simplifying this complex logical expression.
                                                            Open

                                                                  if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
                                                                      (classNames && classNames.all(function(name) {
                                                                        return !name.toString().blank() && cn.include(' ' + name + ' ');
                                                                      }))))
                                                                    elements.push(Element.extend(child));
                                                            Severity: Major
                                                            Found in sample_app/public/javascripts/prototype.js - About 40 mins to fix

                                                              Consider simplifying this complex logical expression.
                                                              Open

                                                                  if (Object.isString(insertions) || Object.isNumber(insertions) ||
                                                                      Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
                                                                        insertions = {bottom:insertions};
                                                              Severity: Major
                                                              Found in sample_app/public/javascripts/prototype.js - About 40 mins to fix

                                                                Function nth has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                Open

                                                                    nth: function(nodes, formula, root, reverse, ofType) {
                                                                Severity: Minor
                                                                Found in sample_app/public/javascripts/prototype.js - About 35 mins to fix

                                                                  Function pseudo has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                  Open

                                                                      pseudo: function(nodes, name, value, root, combinator) {
                                                                  Severity: Minor
                                                                  Found in sample_app/public/javascripts/prototype.js - About 35 mins to fix

                                                                    Function byClassName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                        byClassName: function(nodes, root, className) {
                                                                          if (!nodes) nodes = Selector.handlers.descendant([root]);
                                                                          var needle = ' ' + className + ' ';
                                                                          for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
                                                                            nodeClassName = node.className;
                                                                    Severity: Minor
                                                                    Found in sample_app/public/javascripts/prototype.js - About 35 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 request has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                      request: function(form, options) {
                                                                        form = $(form), options = Object.clone(options || { });
                                                                    
                                                                        var params = options.parameters, action = form.readAttribute('action') || '';
                                                                        if (action.blank()) action = window.location.href;
                                                                    Severity: Minor
                                                                    Found in sample_app/public/javascripts/prototype.js - About 35 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 child has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                        child: function(nodes) {
                                                                          var h = Selector.handlers;
                                                                          for (var i = 0, results = [], node; node = nodes[i]; i++) {
                                                                            for (var j = 0, child; child = node.childNodes[j]; j++)
                                                                              if (child.nodeType == 1 && child.tagName != '!') results.push(child);
                                                                    Severity: Minor
                                                                    Found in sample_app/public/javascripts/prototype.js - About 35 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 attr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                        attr: function(nodes, root, attr, value, operator, combinator) {
                                                                          if (!nodes) nodes = root.getElementsByTagName("*");
                                                                          if (nodes && combinator) nodes = this[combinator](nodes);
                                                                          var handler = Selector.operators[operator], results = [];
                                                                          for (var i = 0, node; node = nodes[i]; i++) {
                                                                    Severity: Minor
                                                                    Found in sample_app/public/javascripts/prototype.js - About 35 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

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                                    return [targetNode];
                                                                    Severity: Major
                                                                    Found in sample_app/public/javascripts/prototype.js - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                            return true;
                                                                      Severity: Major
                                                                      Found in sample_app/public/javascripts/prototype.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                            return value;
                                                                        Severity: Major
                                                                        Found in sample_app/public/javascripts/prototype.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                        if (Element.descendantOf(targetNode, node)) return [targetNode];
                                                                          Severity: Major
                                                                          Found in sample_app/public/javascripts/prototype.js - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                  return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
                                                                            Severity: Major
                                                                            Found in sample_app/public/javascripts/prototype.js - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                  if (!responder) return element;
                                                                              Severity: Major
                                                                              Found in sample_app/public/javascripts/prototype.js - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                    return element;
                                                                                Severity: Major
                                                                                Found in sample_app/public/javascripts/prototype.js - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                      if (!responders) return;
                                                                                  Severity: Major
                                                                                  Found in sample_app/public/javascripts/prototype.js - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                            return [];
                                                                                    Severity: Major
                                                                                    Found in sample_app/public/javascripts/prototype.js - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                                if (node == targetNode) return [targetNode];
                                                                                      Severity: Major
                                                                                      Found in sample_app/public/javascripts/prototype.js - About 30 mins to fix

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

                                                                                          getInputs: function(form, typeName, name) {
                                                                                            form = $(form);
                                                                                            var inputs = form.getElementsByTagName('input');
                                                                                        
                                                                                            if (!typeName && !name) return $A(inputs).map(Element.extend);
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.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 clonePosition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                          clonePosition: function(element, source) {
                                                                                            var options = Object.extend({
                                                                                              setLeft:    true,
                                                                                              setTop:     true,
                                                                                              setWidth:   true,
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.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 getOffsetParent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                          getOffsetParent: function(element) {
                                                                                            if (element.offsetParent) return $(element.offsetParent);
                                                                                            if (element == document.body) return $(element);
                                                                                        
                                                                                            while ((element = element.parentNode) && element != document.body)
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.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 getStorage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                          getStorage: function(element) {
                                                                                            if (!(element = $(element))) return;
                                                                                        
                                                                                            var uid;
                                                                                            if (element === window) {
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                          initialize: function(request){
                                                                                            this.request = request;
                                                                                            var transport  = this.transport  = request.transport,
                                                                                                readyState = this.readyState = transport.readyState;
                                                                                        
                                                                                        
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.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 ObjectRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                        var ObjectRange = Class.create(Enumerable, (function() {
                                                                                          function initialize(start, end, exclusive) {
                                                                                            this.start = start;
                                                                                            this.end = end;
                                                                                            this.exclusive = exclusive;
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.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 attrPresence has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                        Open

                                                                                            attrPresence: function(nodes, root, attr, combinator) {
                                                                                              if (!nodes) nodes = root.getElementsByTagName("*");
                                                                                              if (nodes && combinator) nodes = this[combinator](nodes);
                                                                                              var results = [];
                                                                                              for (var i = 0, node; node = nodes[i]; i++)
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.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

                                                                                          previous: function(element, expression, index) {
                                                                                            element = $(element);
                                                                                            if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
                                                                                            var previousSiblings = Element.previousSiblings(element);
                                                                                            return Object.isNumber(expression) ? previousSiblings[expression] :
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 3 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 2050..2056

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

                                                                                        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

                                                                                          next: function(element, expression, index) {
                                                                                            element = $(element);
                                                                                            if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
                                                                                            var nextSiblings = Element.nextSiblings(element);
                                                                                            return Object.isNumber(expression) ? nextSiblings[expression] :
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 3 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 2042..2048

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

                                                                                        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

                                                                                          function min(iterator, context) {
                                                                                            iterator = iterator || Prototype.K;
                                                                                            var result;
                                                                                            this.each(function(value, index) {
                                                                                              value = iterator.call(context, value, index);
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 821..830

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

                                                                                        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

                                                                                          function max(iterator, context) {
                                                                                            iterator = iterator || Prototype.K;
                                                                                            var result;
                                                                                            this.each(function(value, index) {
                                                                                              value = iterator.call(context, value, index);
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 832..841

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

                                                                                        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

                                                                                          cumulativeScrollOffset: function(element) {
                                                                                            var valueT = 0, valueL = 0;
                                                                                            do {
                                                                                              valueT += element.scrollTop  || 0;
                                                                                              valueL += element.scrollLeft || 0;
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 2296..2304

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

                                                                                        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

                                                                                          cumulativeOffset: function(element) {
                                                                                            var valueT = 0, valueL = 0;
                                                                                            do {
                                                                                              valueT += element.offsetTop  || 0;
                                                                                              valueL += element.offsetLeft || 0;
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 2359..2367

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

                                                                                        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 (m = e.match(ps[i].re)) {
                                                                                                  this.matcher.push(Object.isFunction(x[name]) ? x[name](m) :
                                                                                                    new Template(x[name]).evaluate(m));
                                                                                                  e = e.replace(m[0], '');
                                                                                                  break;
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 3247..3252

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

                                                                                        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

                                                                                          function pointerY(event) {
                                                                                            var docElement = document.documentElement,
                                                                                             body = document.body || { scrollTop: 0 };
                                                                                        
                                                                                            return  event.pageY || (event.clientY +
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 4345..4352

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

                                                                                        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 (m = e.match(p)) {
                                                                                                  this.matcher.push(Object.isFunction(c[name]) ? c[name](m) :
                                                                                                    new Template(c[name]).evaluate(m));
                                                                                                  e = e.replace(m[0], '');
                                                                                                  break;
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 3274..3279

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

                                                                                        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

                                                                                          function pointerX(event) {
                                                                                            var docElement = document.documentElement,
                                                                                             body = document.body || { scrollLeft: 0 };
                                                                                        
                                                                                            return event.pageX || (event.clientX +
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 4354..4361

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

                                                                                        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

                                                                                            'first-child': function(nodes, value, root) {
                                                                                              for (var i = 0, results = [], node; node = nodes[i]; i++) {
                                                                                                if (Selector.handlers.previousElementSibling(node)) continue;
                                                                                                  results.push(node);
                                                                                              }
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 3743..3749

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

                                                                                        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

                                                                                            'last-child': function(nodes, value, root) {
                                                                                              for (var i = 0, results = [], node; node = nodes[i]; i++) {
                                                                                                if (Selector.handlers.nextElementSibling(node)) continue;
                                                                                                  results.push(node);
                                                                                              }
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 3736..3742

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

                                                                                        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

                                                                                          extend(Object, {
                                                                                            extend:        extend,
                                                                                            inspect:       inspect,
                                                                                            toJSON:        toJSON,
                                                                                            toQueryString: toQueryString,
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 1083..1099

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

                                                                                        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

                                                                                          Object.extend(arrayProto, {
                                                                                            _each:     _each,
                                                                                            clear:     clear,
                                                                                            first:     first,
                                                                                            last:      last,
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 2 hrs to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 247..263

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

                                                                                        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 (key in hash) {
                                                                                                  if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
                                                                                                  hash[key].push(value);
                                                                                                }
                                                                                                else hash[key] = value;
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 1 hr to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 3934..3938

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

                                                                                        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 (key in result) {
                                                                                                    if (!Object.isArray(result[key])) result[key] = [result[key]];
                                                                                                    result[key].push(value);
                                                                                                  }
                                                                                                  else result[key] = value;
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 1 hr to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 517..521

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

                                                                                        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

                                                                                            'checked': function(nodes, value, root) {
                                                                                              for (var i = 0, results = [], node; node = nodes[i]; i++)
                                                                                                if (node.checked) results.push(node);
                                                                                              return results;
                                                                                            }
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 1 hr to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 3844..3848

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

                                                                                        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

                                                                                            'disabled': function(nodes, value, root) {
                                                                                              for (var i = 0, results = [], node; node = nodes[i]; i++)
                                                                                                if (node.disabled) results.push(node);
                                                                                              return results;
                                                                                            },
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 1 hr to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 3850..3854

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

                                                                                        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

                                                                                        Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
                                                                                          getValue: function() {
                                                                                            return Form.Element.getValue(this.element);
                                                                                          }
                                                                                        });
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 1 hr to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 4200..4204

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

                                                                                        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

                                                                                        Form.Element.Observer = Class.create(Abstract.TimedObserver, {
                                                                                          getValue: function() {
                                                                                            return Form.Element.getValue(this.element);
                                                                                          }
                                                                                        });
                                                                                        Severity: Major
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 1 hr to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 4253..4257

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

                                                                                        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 (eventName.include(':')) {
                                                                                              if (element.addEventListener)
                                                                                                element.addEventListener("dataavailable", responder, false);
                                                                                              else {
                                                                                                element.attachEvent("ondataavailable", responder);
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 55 mins to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 4578..4590

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

                                                                                        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 (eventName.include(':')) {
                                                                                              if (element.removeEventListener)
                                                                                                element.removeEventListener("dataavailable", responder, false);
                                                                                              else {
                                                                                                element.detachEvent("ondataavailable", responder);
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 55 mins to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 4523..4537

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

                                                                                        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 (el.className !== 'x') {
                                                                                              el.setAttribute('class', 'x');
                                                                                              if (el.className === 'x') {
                                                                                                classProp = 'class';
                                                                                              }
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 40 mins to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 2596..2601

                                                                                        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 (el.htmlFor !== 'x') {
                                                                                              el.setAttribute('htmlFor', 'x');
                                                                                              if (el.htmlFor === 'x') {
                                                                                                forProp = 'htmlFor';
                                                                                              }
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 40 mins to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 2586..2591

                                                                                        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

                                                                                        Form.EventObserver = Class.create(Abstract.EventObserver, {
                                                                                          getValue: function() {
                                                                                            return Form.serialize(this.element);
                                                                                          }
                                                                                        });
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 40 mins to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 4206..4210

                                                                                        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

                                                                                        Form.Observer = Class.create(Abstract.TimedObserver, {
                                                                                          getValue: function() {
                                                                                            return Form.serialize(this.element);
                                                                                          }
                                                                                        });
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 40 mins to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 4259..4263

                                                                                        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 (options.setLeft)   element.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 35 mins to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 2431..2431

                                                                                        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

                                                                                          Event.Methods = {
                                                                                            isLeftClick: isLeftClick,
                                                                                            isMiddleClick: isMiddleClick,
                                                                                            isRightClick: isRightClick,
                                                                                        
                                                                                        
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 35 mins to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 1264..1274

                                                                                        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

                                                                                          return {
                                                                                            toColorPart:    toColorPart,
                                                                                            succ:           succ,
                                                                                            times:          times,
                                                                                            toPaddedString: toPaddedString,
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 35 mins to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 4372..4385

                                                                                        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

                                                                                            if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
                                                                                        Severity: Minor
                                                                                        Found in sample_app/public/javascripts/prototype.js and 1 other location - About 35 mins to fix
                                                                                        sample_app/public/javascripts/prototype.js on lines 2430..2430

                                                                                        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