thiagopradi/octopus

View on GitHub

Showing 170 of 237 total issues

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

  insert: function(element, insertions) {
    element = $(element);

    if (Object.isString(insertions) || Object.isNumber(insertions) ||
        Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
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 updateDrag has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  updateDrag: function(event, pointer) {
    if(!this.dragging) this.startDrag(event);

    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

Method initialize_shards has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize_shards(config)
      @original_config = config

      self.shards = HashWithIndifferentAccess.new
      self.shards_slave_groups = HashWithIndifferentAccess.new
Severity: Major
Found in lib/octopus/proxy_config.rb - About 2 hrs to fix

    Function initialize has 50 lines of code (exceeds 25 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 sample_app/public/javascripts/dragdrop.js - About 2 hrs to fix

      Function Shrink has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Effect.Shrink = function(element) {
        element = $(element);
        var options = Object.extend({
          direction: 'center',
          moveTransition: Effect.Transitions.sinoidal,
      Severity: Minor
      Found in sample_app/public/javascripts/effects.js - About 1 hr to fix

        Function match has a Cognitive Complexity of 15 (exceeds 5 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 sample_app/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 15 (exceeds 5 allowed). Consider refactoring.
        Open

          Element.Methods.setOpacity = function(element, value) {
            element = $(element);
            element.style.opacity = (value == 1 || value === '') ? '' :
              (value < 0.00001) ? 0 : value;
        
        
        Severity: Minor
        Found in sample_app/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 dealWithDeprecatedOptions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
          if (!options) return;
          function fallback(name, expr) {
            if (name in options || expr === undefined) return;
            options[name] = expr;
        Severity: Minor
        Found in sample_app/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 onHover has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

          onHover: function(element, dropon, overlap) {
            if(Element.isParent(dropon, element)) return;
        
            if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
              return;
        Severity: Minor
        Found in sample_app/public/javascripts/dragdrop.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 getStyle has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            function(proceed, element, style) {
              switch (style) {
                case 'left': case 'top': case 'right': case 'bottom':
                  if (proceed(element, 'position') === 'static') return null;
                case 'height': case 'width':
        Severity: Minor
        Found in sample_app/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 draw has a Cognitive Complexity of 15 (exceeds 5 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 sample_app/public/javascripts/dragdrop.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

        Method with_each_healthy_shard has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def with_each_healthy_shard
              shards.each do |shard_name, v|
                begin
                  yield(v)
                rescue => e
        Severity: Minor
        Found in lib/octopus/proxy.rb - 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 _createResponder has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function _createResponder(element, eventName, handler) {
            var registry = Element.retrieve(element, 'prototype_event_registry');
        
            if (Object.isUndefined(registry)) {
              CACHE.push(element);
        Severity: Minor
        Found in sample_app/public/javascripts/prototype.js - About 1 hr to fix

          Function request has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            request: function(url) {
              this.url = url;
              this.method = this.options.method;
              var params = Object.clone(this.options.parameters);
          
          
          Severity: Minor
          Found in sample_app/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 setOptions has 41 lines of code (exceeds 25 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 1 hr to fix

            Function getElementsByClassName has a Cognitive Complexity of 13 (exceeds 5 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 sample_app/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 select has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              select: function(element, value) {
                if (Object.isUndefined(value))
                  return this[element.type == 'select-one' ?
                    'selectOne' : 'selectMany'](element);
                else {
            Severity: Minor
            Found in sample_app/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 setRequestHeaders has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              setRequestHeaders: function() {
                var headers = {
                  'X-Requested-With': 'XMLHttpRequest',
                  'X-Prototype-Version': Prototype.Version,
                  'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
            Severity: Minor
            Found in sample_app/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 setStyle has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              setStyle: function(element, styles) {
                element = $(element);
                var elementStyle = element.style, match;
                if (Object.isString(styles)) {
                  element.style.cssText += ';' + styles;
            Severity: Minor
            Found in sample_app/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 baseInitialize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              baseInitialize: function(element, update, options) {
                element          = $(element);
                this.element     = element;
                this.update      = $(update);
                this.hasFocus    = false;
            Severity: Minor
            Found in sample_app/public/javascripts/controls.js - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language