thiagopradi/octopus

View on GitHub

Showing 170 of 237 total issues

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 sample_app/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 sample_app/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

Method current_shard= has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def current_shard=(shard_symbol)
      if shard_symbol.is_a?(Array)
        self.current_slave_group = nil
        shard_symbol.each { |symbol| fail "Nonexistent Shard Name: #{symbol}" if shards[symbol].nil? }
      elsif shard_symbol.is_a?(Hash)
Severity: Minor
Found in lib/octopus/proxy_config.rb - 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 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 sample_app/public/javascripts/prototype.js - About 2 hrs to fix

    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 sample_app/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 _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 sample_app/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

    Method initialize_shards has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize_shards(config)
          @original_config = config
    
          self.shards = HashWithIndifferentAccess.new
          self.shards_slave_groups = HashWithIndifferentAccess.new
    Severity: Minor
    Found in lib/octopus/proxy_config.rb - 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 sample_app/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 sample_app/public/javascripts/controls.js - About 2 hrs to fix

        File proxy.rb has 273 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'set'
        require 'octopus/slave_group'
        require 'octopus/load_balancing/round_robin'
        
        module Octopus
        Severity: Minor
        Found in lib/octopus/proxy.rb - 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 sample_app/public/javascripts/controls.js - About 2 hrs to fix

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

              Function finishDrag has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                finishDrag: function(event, success) {
                  this.dragging = false;
              
                  if(this.options.quiet){
                    Position.prepare();
              Severity: Minor
              Found in sample_app/public/javascripts/dragdrop.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 onEmptyHover has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                onEmptyHover: function(element, dropon, overlap) {
                  var oldParentNode = element.parentNode;
                  var droponOptions = Sortable.options(dropon);
              
                  if(!Element.isParent(dropon, element)) {
              Severity: Minor
              Found in sample_app/public/javascripts/dragdrop.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 Class has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var Class = (function() {
                function subclass() {};
                function create() {
                  var parent = null, properties = $A(arguments);
                  if (Object.isFunction(properties[0]))
              Severity: Major
              Found in sample_app/public/javascripts/prototype.js - About 2 hrs to fix

                Function index has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    index: function(parentNode, reverse, ofType) {
                      parentNode._countedByPrototype = Prototype.emptyFunction;
                      if (reverse) {
                        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
                          var node = nodes[i];
                Severity: Minor
                Found in sample_app/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

                Severity
                Category
                Status
                Source
                Language