felipero/couchrails

View on GitHub

Showing 206 of 206 total issues

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

  enterHover: function(e) {
    if (this.options.hoverClassName)
      this.element.addClassName(this.options.hoverClassName);
    if (this._saving) return;
    this.triggerCallback('onEnterHover');
Severity: Major
Found in examples/helloworld/public/javascripts/controls.js and 1 other location - About 1 hr to fix
examples/helloworld/public/javascripts/controls.js on lines 662..667

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

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

  leaveHover: function(e) {
    if (this.options.hoverClassName)
      this.element.removeClassName(this.options.hoverClassName);
    if (this._saving) return;
    this.triggerCallback('onLeaveHover');
Severity: Major
Found in examples/helloworld/public/javascripts/controls.js and 1 other location - About 1 hr to fix
examples/helloworld/public/javascripts/controls.js on lines 602..607

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

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 setup has 37 lines of code (exceeds 25 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 1 hr to fix

    Function start has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      start: function(options) {
        if (options && options.transition === false) options.transition = Effect.Transitions.linear;
        this.options      = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
        this.currentFrame = 0;
        this.state        = 'idle';
    Severity: Minor
    Found in examples/helloworld/public/javascripts/effects.js - About 1 hr to fix

      Function finishDrag has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        finishDrag: function(event, success) {
          this.dragging = false;
      
          if(this.options.quiet){
            Position.prepare();
      Severity: Minor
      Found in examples/helloworld/public/javascripts/dragdrop.js - About 1 hr to fix

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

              if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
        Severity: Major
        Found in examples/helloworld/public/javascripts/dragdrop.js and 3 other locations - About 1 hr to fix
        examples/helloworld/public/javascripts/dragdrop.js on lines 384..384
        examples/helloworld/public/javascripts/dragdrop.js on lines 385..385
        examples/helloworld/public/javascripts/dragdrop.js on lines 387..387

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

        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

            afterUpdateInternal: function(effect) {
              effect.element.down().setStyle({bottom:
                (effect.dims[0] - effect.element.clientHeight) + 'px' });
            },
        Severity: Major
        Found in examples/helloworld/public/javascripts/effects.js and 1 other location - About 1 hr to fix
        examples/helloworld/public/javascripts/effects.js on lines 726..729

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

        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

            afterUpdateInternal: function(effect) {
              effect.element.down().setStyle({bottom:
                (effect.dims[0] - effect.element.clientHeight) + 'px' });
            },
        Severity: Major
        Found in examples/helloworld/public/javascripts/effects.js and 1 other location - About 1 hr to fix
        examples/helloworld/public/javascripts/effects.js on lines 698..701

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

        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 4 locations. Consider refactoring.
        Open

              if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
        Severity: Major
        Found in examples/helloworld/public/javascripts/dragdrop.js and 3 other locations - About 1 hr to fix
        examples/helloworld/public/javascripts/dragdrop.js on lines 384..384
        examples/helloworld/public/javascripts/dragdrop.js on lines 385..385
        examples/helloworld/public/javascripts/dragdrop.js on lines 386..386

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

        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 4 locations. Consider refactoring.
        Open

              if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
        Severity: Major
        Found in examples/helloworld/public/javascripts/dragdrop.js and 3 other locations - About 1 hr to fix
        examples/helloworld/public/javascripts/dragdrop.js on lines 385..385
        examples/helloworld/public/javascripts/dragdrop.js on lines 386..386
        examples/helloworld/public/javascripts/dragdrop.js on lines 387..387

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

        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 4 locations. Consider refactoring.
        Open

              if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
        Severity: Major
        Found in examples/helloworld/public/javascripts/dragdrop.js and 3 other locations - About 1 hr to fix
        examples/helloworld/public/javascripts/dragdrop.js on lines 384..384
        examples/helloworld/public/javascripts/dragdrop.js on lines 386..386
        examples/helloworld/public/javascripts/dragdrop.js on lines 387..387

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

        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 (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 examples/helloworld/public/javascripts/prototype.js - About 1 hr to fix

          Function onKeyPress has 33 lines of code (exceeds 25 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 1 hr to fix

            Function selector has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  selector: function(instance) {
                    var ret       = []; // Beginning matches
                    var partial   = []; // Inside matches
                    var entry     = instance.getToken();
                    var count     = 0;
            Severity: Minor
            Found in examples/helloworld/public/javascripts/controls.js - About 1 hr to fix

              Function draw has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                draw: function(point) {
                  var pos = this.element.cumulativeOffset();
                  if(this.options.ghosting) {
                    var r   = Position.realOffset(this.element);
                    pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
              Severity: Minor
              Found in examples/helloworld/public/javascripts/dragdrop.js - About 1 hr to fix

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

                  createEditField: function() {
                    var text = (this.options.loadTextURL ? this.options.loadingText : this.getText());
                    var fld;
                    if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) {
                      fld = document.createElement('input');
                Severity: Minor
                Found in examples/helloworld/public/javascripts/controls.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 examples/helloworld/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 examples/helloworld/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 examples/helloworld/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 examples/helloworld/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

                Severity
                Category
                Status
                Source
                Language