felipero/couchrails

View on GitHub

Showing 206 of 206 total issues

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

  show: function(point, element) {
    if(!this.drops.length) return;
    var drop, affected = [];

    this.drops.each( function(drop) {
Severity: Minor
Found in examples/helloworld/public/javascripts/dragdrop.js - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

  fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' :
    options.cancelLink == options.cancelButton == false ? false : undefined)));
Severity: Minor
Found in examples/helloworld/public/javascripts/controls.js and 1 other location - About 45 mins to fix
examples/helloworld/public/javascripts/controls.js on lines 865..866

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

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

Avoid deeply nested control flow statements.
Open

                if (!attribute) return null;
Severity: Major
Found in examples/helloworld/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 examples/helloworld/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 examples/helloworld/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 examples/helloworld/public/javascripts/prototype.js - About 45 mins to fix

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

            createControl: function(mode, handler, extraClasses) {
              var control = this.options[mode + 'Control'];
              var text = this.options[mode + 'Text'];
              if ('button' == control) {
                var btn = document.createElement('input');
          Severity: Minor
          Found in examples/helloworld/public/javascripts/controls.js - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function 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 examples/helloworld/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(element.tagName.toUpperCase() == 'IMG' && element.width) {
                  element.width++; element.width--;
                } else try {
                  var n = document.createTextNode(' ');
                  element.appendChild(n);
          Severity: Major
          Found in examples/helloworld/public/javascripts/prototype.js - About 45 mins to fix

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

              fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' :
                options.okLink == options.okButton == false ? false : undefined)));
            Severity: Minor
            Found in examples/helloworld/public/javascripts/controls.js and 1 other location - About 45 mins to fix
            examples/helloworld/public/javascripts/controls.js on lines 863..864

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

            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 attr has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

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

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

                create: function(element) {
                  element = $(element);
                  var options = Object.extend({
                    element:     element,
                    tag:         'li',       // assumes li children, override with tag: 'tagname'
              Severity: Minor
              Found in examples/helloworld/public/javascripts/dragdrop.js - About 45 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

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

                _tree: function(element, options, parent) {
                  var children = Sortable.findElements(element, options) || [];
              
                  for (var i = 0; i < children.length; ++i) {
                    var match = children[i].id.match(options.format);
              Severity: Minor
              Found in examples/helloworld/public/javascripts/dragdrop.js - About 45 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

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

                  if((!this.options.constraint) || (this.options.constraint=='horizontal'))
                    style.left = p[0] + "px";
              Severity: Minor
              Found in examples/helloworld/public/javascripts/dragdrop.js and 1 other location - About 40 mins to fix
              examples/helloworld/public/javascripts/dragdrop.js on lines 492..493

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 49.

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

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

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

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

              Refactorings

              Further Reading

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

                  if((!this.options.constraint) || (this.options.constraint=='vertical'))
                    style.top  = p[1] + "px";
              Severity: Minor
              Found in examples/helloworld/public/javascripts/dragdrop.js and 1 other location - About 40 mins to fix
              examples/helloworld/public/javascripts/dragdrop.js on lines 490..491

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 49.

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

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

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

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

              Refactorings

              Further Reading

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

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

              Form.Observer = Class.create(Abstract.TimedObserver, {
                getValue: function() {
                  return Form.serialize(this.element);
                }
              });
              Severity: Minor
              Found in examples/helloworld/public/javascripts/prototype.js and 1 other location - About 40 mins to fix
              examples/helloworld/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

              Form.EventObserver = Class.create(Abstract.EventObserver, {
                getValue: function() {
                  return Form.serialize(this.element);
                }
              });
              Severity: Minor
              Found in examples/helloworld/public/javascripts/prototype.js and 1 other location - About 40 mins to fix
              examples/helloworld/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

              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 examples/helloworld/public/javascripts/prototype.js - About 40 mins to fix
                Severity
                Category
                Status
                Source
                Language