Floppy/carbon-diet

View on GitHub

Showing 215 of 292 total issues

Function SlideUp has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Effect.SlideUp = function(element) {
  element = $(element).cleanWhitespace();
  var oldInnerBottom = element.down().getStyle('bottom');
  var elementDimensions = element.getDimensions();
  return new Effect.Scale(element, window.opera ? 0 : 1,
Severity: Minor
Found in app/assets/javascripts/standard/effects.js - About 1 hr to fix

    Function initialize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      initialize: function(element) {
        this.element = $(element);
        if (!this.element) throw(Effect._elementDoesNotExistError);
        var options = Object.extend({
          style: { }
    Severity: Minor
    Found in app/assets/javascripts/standard/effects.js - About 1 hr to fix

      Method wml_select has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def wml_select(name, values, default=nil, value_func = nil, value_text = nil)
          ivalue = values.index(default)
          wml = "<select name='#{name}'"
          wml << " ivalue='#{ivalue+1}'" if ivalue
          wml << ">"
      Severity: Minor
      Found in app/helpers/wml_helper.rb - About 1 hr to fix

        Function startDrag has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          startDrag: function(event) {
            this.dragging = true;
            if(!this.delta)
              this.delta = this.currentDelta();
        
        
        Severity: Minor
        Found in app/assets/javascripts/standard/dragdrop.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

              if (element && isPercentage) {
                context = context || element.parentNode;
                var decimal = toDecimal(value);
                var whole = null;
                var position = element.getStyle('position');
          Severity: Major
          Found in app/assets/javascripts/standard/prototype.js - About 1 hr to fix

            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 app/assets/javascripts/standard/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

            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 app/assets/javascripts/standard/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 app/assets/javascripts/standard/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 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 app/assets/javascripts/standard/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 Hash has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            var Hash = Class.create(Enumerable, (function() {
              function initialize(object) {
                this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
              }
            
            
            Severity: Minor
            Found in app/assets/javascripts/standard/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 Selector has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            Prototype.Selector = (function() {
            
              function select() {
                throw new Error('Method "Prototype.Selector.select" must be defined.');
              }
            Severity: Minor
            Found in app/assets/javascripts/standard/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 app/assets/javascripts/standard/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

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

              def emissions
                # Initialise result array
                emissiondata = EmissionArray.new
                # Create "last reading" trackers
                last_kWh = 0;
            Severity: Minor
            Found in app/models/electricity_account.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 app/assets/javascripts/standard/prototype.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if ( !anyFound ) {
                                      return [];
                                  }
              Severity: Major
              Found in app/assets/javascripts/standard/prototype.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if ( !isXML ) {
                                        elem.sizcache = doneName;
                                        elem.sizset = i;
                                    }
                Severity: Major
                Found in app/assets/javascripts/standard/prototype.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if ( typeof cur !== "string" ) {
                                          if ( elem === cur ) {
                                              match = true;
                                              break;
                                          }
                  Severity: Major
                  Found in app/assets/javascripts/standard/prototype.js - About 45 mins to fix

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

                      getTokenBounds: function() {
                        if (null != this.tokenBounds) return this.tokenBounds;
                        var value = this.element.value;
                        if (value.strip().empty()) return [-1, 0];
                        var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue);
                    Severity: Minor
                    Found in app/assets/javascripts/standard/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 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 app/assets/javascripts/standard/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 (Element.getStyle(element, 'position') == 'absolute') break;
                    Severity: Major
                    Found in app/assets/javascripts/standard/prototype.js - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language