thiagopradi/octopus

View on GitHub

Showing 237 of 237 total issues

File prototype.js has 4031 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*  Prototype JavaScript framework, version 1.6.1
 *  (c) 2005-2009 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
Severity: Major
Found in sample_app/public/javascripts/prototype.js - About 1 wk to fix

    File effects.js has 1014 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
    
    // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
    // Contributors:
    //  Justin Palmer (http://encytemedia.com/)
    Severity: Major
    Found in sample_app/public/javascripts/effects.js - About 2 days to fix

      File controls.js has 804 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
      
      // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
      //           (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
      //           (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
      Severity: Major
      Found in sample_app/public/javascripts/controls.js - About 1 day to fix

        File dragdrop.js has 786 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
        
        // Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
        //
        // script.aculo.us is freely distributable under the terms of an MIT-style license.
        Severity: Major
        Found in sample_app/public/javascripts/dragdrop.js - About 1 day to fix

          Function id has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
          Open

              id: function(nodes, root, id, combinator) {
                var targetNode = $(id), h = Selector.handlers;
          
                if (root == document) {
                  if (!targetNode) return [];
          Severity: Minor
          Found in sample_app/public/javascripts/prototype.js - About 1 day 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 209 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var Enumerable = (function() {
            function each(iterator, context) {
              var index = 0;
              try {
                this._each(function(value) {
          Severity: Major
          Found in sample_app/public/javascripts/prototype.js - About 1 day to fix

            Methods has 56 functions (exceeds 20 allowed). Consider refactoring.
            Open

            Element.Methods = {
              visible: function(element) {
                return $(element).style.display != 'none';
              },
            
            
            Severity: Major
            Found in sample_app/public/javascripts/prototype.js - About 1 day to fix

              Class Proxy has 44 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Proxy
                  attr_accessor :proxy_config
              
                  delegate :current_model, :current_model=,
                           :current_shard, :current_shard=,
              Severity: Minor
              Found in lib/octopus/proxy.rb - About 6 hrs to fix

                Function addMethods has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                Element.addMethods = function(methods) {
                  var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
                
                  if (!methods) {
                    Object.extend(Form, Form.Methods);
                Severity: Minor
                Found in sample_app/public/javascripts/prototype.js - About 4 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 update has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                  update: (function(){
                
                    var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
                      var el = document.createElement("select"),
                          isBuggy = true;
                Severity: Minor
                Found in sample_app/public/javascripts/prototype.js - About 4 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 nth has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                    nth: function(nodes, formula, root, reverse, ofType) {
                      if (nodes.length == 0) return [];
                      if (formula == 'even') formula = '2n+0';
                      if (formula == 'odd')  formula = '2n+1';
                      var h = Selector.handlers, results = [], indexed = [], m;
                Severity: Minor
                Found in sample_app/public/javascripts/prototype.js - About 4 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 setOptions has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                  setOptions: function(options) {
                    this.options = Object.extend({
                      choices: 10,
                      partialSearch: true,
                      partialChars: 2,
                Severity: Minor
                Found in sample_app/public/javascripts/controls.js - About 4 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 start has a Cognitive Complexity of 26 (exceeds 5 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 sample_app/public/javascripts/effects.js - About 3 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 Hash has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var Hash = Class.create(Enumerable, (function() {
                  function initialize(object) {
                    this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
                  }
                
                
                Severity: Major
                Found in sample_app/public/javascripts/prototype.js - About 3 hrs to fix

                  Function create has 87 lines of code (exceeds 25 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: Major
                  Found in sample_app/public/javascripts/dragdrop.js - About 3 hrs to fix

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

                          if(dropon.previousSibling != element) {
                            var oldParentNode = element.parentNode;
                            element.style.visibility = "hidden"; // fix gecko rendering
                            dropon.parentNode.insertBefore(element, dropon);
                            if(dropon.parentNode!=oldParentNode)
                    Severity: Major
                    Found in sample_app/public/javascripts/dragdrop.js and 1 other location - About 3 hrs to fix
                    sample_app/public/javascripts/dragdrop.js on lines 770..777

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

                    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(nextElement != element) {
                            var oldParentNode = element.parentNode;
                            element.style.visibility = "hidden"; // fix gecko rendering
                            dropon.parentNode.insertBefore(element, nextElement);
                            if(dropon.parentNode!=oldParentNode)
                    Severity: Major
                    Found in sample_app/public/javascripts/dragdrop.js and 1 other location - About 3 hrs to fix
                    sample_app/public/javascripts/dragdrop.js on lines 759..766

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

                    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

                      next: function(element, expression, index) {
                        element = $(element);
                        if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
                        var nextSiblings = Element.nextSiblings(element);
                        return Object.isNumber(expression) ? nextSiblings[expression] :
                    Severity: Major
                    Found in sample_app/public/javascripts/prototype.js and 1 other location - About 3 hrs to fix
                    sample_app/public/javascripts/prototype.js on lines 2042..2048

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

                    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

                      previous: function(element, expression, index) {
                        element = $(element);
                        if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
                        var previousSiblings = Element.previousSiblings(element);
                        return Object.isNumber(expression) ? previousSiblings[expression] :
                    Severity: Major
                    Found in sample_app/public/javascripts/prototype.js and 1 other location - About 3 hrs to fix
                    sample_app/public/javascripts/prototype.js on lines 2050..2056

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

                    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 getStyle has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                      Element.Methods.getStyle = function(element, style) {
                        element = $(element);
                        style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
                        var value = element.style[style];
                        if (!value && element.currentStyle) value = element.currentStyle[style];
                    Severity: Minor
                    Found in sample_app/public/javascripts/prototype.js - About 3 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

                    Severity
                    Category
                    Status
                    Source
                    Language