felipero/couchrails

View on GitHub

Showing 206 of 206 total issues

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 examples/helloworld/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 examples/helloworld/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 examples/helloworld/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 examples/helloworld/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

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

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

      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 examples/helloworld/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 examples/helloworld/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 examples/helloworld/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 Grow has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Effect.Grow = function(element) {
          element = $(element);
          var options = Object.extend({
            direction: 'center',
            moveTransition: Effect.Transitions.sinoidal,
        Severity: Major
        Found in examples/helloworld/public/javascripts/effects.js - About 2 hrs to fix

          InPlaceEditor has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          Ajax.InPlaceEditor = Class.create({
            initialize: function(element, url, options) {
              this.url = url;
              this.element = element = $(element);
              this.prepareOptions();
          Severity: Minor
          Found in examples/helloworld/public/javascripts/controls.js - About 2 hrs to fix

            Base has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            Autocompleter.Base = Class.create({
              baseInitialize: function(element, update, options) {
                element          = $(element);
                this.element     = element;
                this.update      = $(update);
            Severity: Minor
            Found in examples/helloworld/public/javascripts/controls.js - About 2 hrs to fix

              Function setup has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                setup: function(){
                  function parseColor(color){
                    if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
                    color = color.parseColor();
                    return $R(0,2).map(function(i){
              Severity: Minor
              Found in examples/helloworld/public/javascripts/effects.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 parseColor has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

              String.prototype.parseColor = function() {
                var color = '#';
                if (this.slice(0,4) == 'rgb(') {
                  var cols = this.slice(4,this.length-1).split(',');
                  var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
              Severity: Minor
              Found in examples/helloworld/public/javascripts/effects.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 examples/helloworld/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 setDimensions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                setDimensions: function(height, width) {
                  var d = { };
                  if (this.options.scaleX) d.width = width.round() + 'px';
                  if (this.options.scaleY) d.height = height.round() + 'px';
                  if (this.options.scaleFromCenter) {
              Severity: Minor
              Found in examples/helloworld/public/javascripts/effects.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

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

              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 examples/helloworld/public/javascripts/prototype.js - About 2 hrs to fix

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

                Severity
                Category
                Status
                Source
                Language