felipero/couchrails

View on GitHub

Showing 206 of 206 total issues

Consider simplifying this complex logical expression.
Open

      if((tag_name = src.tagName.toUpperCase()) && (
        tag_name=='INPUT' ||
        tag_name=='SELECT' ||
        tag_name=='OPTION' ||
        tag_name=='BUTTON' ||
Severity: Major
Found in examples/helloworld/public/javascripts/dragdrop.js - About 40 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 examples/helloworld/public/javascripts/prototype.js - About 40 mins to fix

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

                   afterFinishInternal: function(effect) {
                     effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
                   }
      Severity: Minor
      Found in examples/helloworld/public/javascripts/effects.js and 1 other location - About 40 mins to fix
      examples/helloworld/public/javascripts/effects.js on lines 648..650

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

      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

              afterFinishInternal: function(effect) {
                effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
              }
      Severity: Minor
      Found in examples/helloworld/public/javascripts/effects.js and 1 other location - About 40 mins to fix
      examples/helloworld/public/javascripts/effects.js on lines 816..818

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          nth: function(nodes, formula, root, reverse, ofType) {
      Severity: Minor
      Found in examples/helloworld/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 examples/helloworld/public/javascripts/prototype.js - About 35 mins to fix

          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 examples/helloworld/public/javascripts/prototype.js and 1 other location - About 35 mins to fix
          examples/helloworld/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

            return {
              toColorPart:    toColorPart,
              succ:           succ,
              times:          times,
              toPaddedString: toPaddedString,
          Severity: Minor
          Found in examples/helloworld/public/javascripts/prototype.js and 1 other location - About 35 mins to fix
          examples/helloworld/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

            Event.Methods = {
              isLeftClick: isLeftClick,
              isMiddleClick: isMiddleClick,
              isRightClick: isRightClick,
          
          
          Severity: Minor
          Found in examples/helloworld/public/javascripts/prototype.js and 1 other location - About 35 mins to fix
          examples/helloworld/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

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

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 47.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

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

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 47.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

              if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
          Severity: Minor
          Found in examples/helloworld/public/javascripts/prototype.js and 1 other location - About 35 mins to fix
          examples/helloworld/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

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

            initialize: function(element, url, options) {
              this.url = url;
              this.element = element = $(element);
              this.prepareOptions();
              this._controls = { };
          Severity: Minor
          Found in examples/helloworld/public/javascripts/controls.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 examples/helloworld/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 examples/helloworld/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 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 examples/helloworld/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 onKeyPress has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            onKeyPress: function(event) {
              if(this.active)
                switch(event.keyCode) {
                 case Event.KEY_TAB:
                 case Event.KEY_RETURN:
          Severity: Minor
          Found in examples/helloworld/public/javascripts/controls.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 examples/helloworld/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 baseInitialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            baseInitialize: function(element, update, options) {
              element          = $(element);
              this.element     = element;
              this.update      = $(update);
              this.hasFocus    = false;
          Severity: Minor
          Found in examples/helloworld/public/javascripts/controls.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

              if (!responder) return element;
          Severity: Major
          Found in examples/helloworld/public/javascripts/prototype.js - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language