felipero/couchrails

View on GitHub

Showing 206 of 206 total issues

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

  initialize: function(element) {
    this.element = $(element);
    if (!this.element) throw(Effect._elementDoesNotExistError);
    var options = Object.extend({
      style: { }
Severity: Minor
Found in examples/helloworld/public/javascripts/effects.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 examples/helloworld/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 examples/helloworld/public/javascripts/prototype.js - About 1 hr to fix

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

        Effect.SlideUp = function(element) {
          element = $(element).cleanWhitespace();
          var oldInnerBottom = element.down().getStyle('bottom');
          var elementDimensions = element.getDimensions();
          return new Effect.Scale(element, window.opera ? 0 : 1,
        Severity: Minor
        Found in examples/helloworld/public/javascripts/effects.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 examples/helloworld/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 examples/helloworld/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 examples/helloworld/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 examples/helloworld/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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            render: function() {
              if(this.entryCount > 0) {
                for (var i = 0; i < this.entryCount; i++)
                  this.index==i ?
                    Element.addClassName(this.getEntry(i),"selected") :
          Severity: Minor
          Found in examples/helloworld/public/javascripts/controls.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 examples/helloworld/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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

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

          Cognitive Complexity

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

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

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

          Further reading

          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 examples/helloworld/public/javascripts/prototype.js and 1 other location - About 55 mins to fix
          examples/helloworld/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 3 locations. Consider refactoring.
          Open

                  transform.unit=='color' ? '#'+
                    (Math.round(transform.originalValue[0]+
                      (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
          Severity: Major
          Found in examples/helloworld/public/javascripts/effects.js and 2 other locations - About 55 mins to fix
          examples/helloworld/public/javascripts/effects.js on lines 991..995
          examples/helloworld/public/javascripts/effects.js on lines 991..997

          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.addEventListener)
                  element.addEventListener("dataavailable", responder, false);
                else {
                  element.attachEvent("ondataavailable", responder);
          Severity: Minor
          Found in examples/helloworld/public/javascripts/prototype.js and 1 other location - About 55 mins to fix
          examples/helloworld/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

          Avoid deeply nested control flow statements.
          Open

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

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

              getTokenBounds: function() {
                if (null != this.tokenBounds) return this.tokenBounds;
                var value = this.element.value;
                if (value.strip().empty()) return [-1, 0];
                var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue);
            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

            Avoid deeply nested control flow statements.
            Open

                    if (value[1]) return parseFloat(value[1]) / 100;
            Severity: Major
            Found in examples/helloworld/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 examples/helloworld/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 examples/helloworld/public/javascripts/prototype.js - About 45 mins to fix

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

                    loop: function(timePos) {
                      if (timePos >= this.startOn) {
                        if (timePos >= this.finishOn) {
                          this.render(1.0);
                          this.cancel();
                  Severity: Minor
                  Found in examples/helloworld/public/javascripts/effects.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

                  Severity
                  Category
                  Status
                  Source
                  Language