thiagopradi/octopus

View on GitHub

Showing 170 of 237 total issues

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

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

Method shards has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def shards
        shards = Set.new

        if (groups = (current_group_specified ? current_group : Octopus.config[:default_migration_group]))
          Array.wrap(groups).each do |group|
Severity: Minor
Found in lib/octopus/migration.rb - 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

Avoid deeply nested control flow statements.
Open

        if (value[1]) return parseFloat(value[1]) / 100;
Severity: Major
Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

          if(element.tagName.toUpperCase() == 'IMG' && element.width) {
            element.width++; element.width--;
          } else try {
            var n = document.createTextNode(' ');
            element.appendChild(n);
    Severity: Major
    Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if (node.nodeIndex == indices[j]) results.push(node);
      Severity: Major
      Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

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

          updateContent: function(responseText) {
            var receiver = this.container[this.success() ? 'success' : 'failure'],
                options = this.options;
        
            if (!options.evalScripts) responseText = responseText.stripScripts();
        Severity: Minor
        Found in sample_app/public/javascripts/prototype.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

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

          createControl: function(mode, handler, extraClasses) {
            var control = this.options[mode + 'Control'];
            var text = this.options[mode + 'Text'];
            if ('button' == control) {
              var btn = document.createElement('input');
        Severity: Minor
        Found in sample_app/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

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

          _tree: function(element, options, parent) {
            var children = Sortable.findElements(element, options) || [];
        
            for (var i = 0; i < children.length; ++i) {
              var match = children[i].id.match(options.format);
        Severity: Minor
        Found in sample_app/public/javascripts/dragdrop.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 (!attribute) return null;
        Severity: Major
        Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                        if (targetNode.parentNode == node) return [targetNode];
          Severity: Major
          Found in sample_app/public/javascripts/prototype.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

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

              Avoid deeply nested control flow statements.
              Open

                          for (var i = 0, node; node = nodes[i]; i++)
                            if (Element.descendantOf(targetNode, node)) return [targetNode];
              Severity: Major
              Found in sample_app/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 sample_app/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 sample_app/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

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

                    show: function(point, element) {
                      if(!this.drops.length) return;
                      var drop, affected = [];
                  
                      this.drops.each( function(drop) {
                  Severity: Minor
                  Found in sample_app/public/javascripts/dragdrop.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