Floppy/carbon-diet

View on GitHub

Showing 292 of 292 total issues

Function CHILD has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        CHILD: function(elem, match){
            var type = match[1], node = elem;
            switch (type) {
                case 'only':
                case 'first':
Severity: Minor
Found in app/assets/javascripts/standard/prototype.js - About 1 hr to fix

    Function setup has 37 lines of code (exceeds 25 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 app/assets/javascripts/standard/effects.js - About 1 hr to fix

      Function showPage has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          showPage: function(page, backwards)
          {
              if (page)
              {
      //            if (window.iui_ext)    window.iui_ext.injectEventMethods(page);    // TG -- why was this comment left here??
      Severity: Minor
      Found in public/iui/iui.js - About 1 hr to fix

        Function stopObserving has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function stopObserving(element, eventName, handler) {
            element = $(element);
        
            var registry = Element.retrieve(element, 'prototype_event_registry');
            if (!registry) return element;
        Severity: Minor
        Found in app/assets/javascripts/standard/prototype.js - About 1 hr to fix

          Function start has 36 lines of code (exceeds 25 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 app/assets/javascripts/standard/effects.js - About 1 hr to fix

            Method emissions has 36 lines of code (exceeds 25 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 1 hr to fix

              Function finishDrag has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                finishDrag: function(event, success) {
                  this.dragging = false;
              
                  if(this.options.quiet){
                    Position.prepare();
              Severity: Minor
              Found in app/assets/javascripts/standard/dragdrop.js - About 1 hr to fix

                Method import_from_partow_net_db has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.import_from_partow_net_db   
                    file = open("GlobalAirportDatabase.txt")          
                    # For each line in the file
                    file.each do |line|
                      # Split into data fields
                Severity: Minor
                Found in app/models/airport.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 dirCheck has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
                    var sibDir = dir == "previousSibling" && !isXML;
                    for ( var i = 0, l = checkSet.length; i < l; i++ ) {
                        var elem = checkSet[i];
                        if ( elem ) {
                Severity: Minor
                Found in app/assets/javascripts/standard/prototype.js - About 1 hr to fix

                  Function showPageByHref has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      showPageByHref: function(href, args, method, replace, cb)
                      {
                        // I don't think we need onerror, because readstate will still go to 4 in that case
                          function spbhCB(xhr) 
                          {
                  Severity: Minor
                  Found in public/iui/iui.js - About 1 hr to fix

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

                          if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
                    Severity: Major
                    Found in app/assets/javascripts/standard/dragdrop.js and 3 other locations - About 1 hr to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 384..384
                    app/assets/javascripts/standard/dragdrop.js on lines 385..385
                    app/assets/javascripts/standard/dragdrop.js on lines 386..386

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

                    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

                        afterUpdateInternal: function(effect) {
                          effect.element.down().setStyle({bottom:
                            (effect.dims[0] - effect.element.clientHeight) + 'px' });
                        },
                    Severity: Major
                    Found in app/assets/javascripts/standard/effects.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/standard/effects.js on lines 726..729

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

                    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

                          'padding-box-width': function(element) {
                            var width = this.get('width'),
                             pLeft = this.get('padding-left'),
                             pRight = this.get('padding-right');
                    
                    
                    Severity: Major
                    Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/standard/prototype.js on lines 3420..3426

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

                    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 4 locations. Consider refactoring.
                    Open

                          if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
                    Severity: Major
                    Found in app/assets/javascripts/standard/dragdrop.js and 3 other locations - About 1 hr to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 385..385
                    app/assets/javascripts/standard/dragdrop.js on lines 386..386
                    app/assets/javascripts/standard/dragdrop.js on lines 387..387

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

                    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

                          'padding-box-height': function(element) {
                            var height = this.get('height'),
                             pTop = this.get('padding-top'),
                             pBottom = this.get('padding-bottom');
                    
                    
                    Severity: Major
                    Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/standard/prototype.js on lines 3428..3434

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

                    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 4 locations. Consider refactoring.
                    Open

                          if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
                    Severity: Major
                    Found in app/assets/javascripts/standard/dragdrop.js and 3 other locations - About 1 hr to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 384..384
                    app/assets/javascripts/standard/dragdrop.js on lines 386..386
                    app/assets/javascripts/standard/dragdrop.js on lines 387..387

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

                    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 4 locations. Consider refactoring.
                    Open

                          if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
                    Severity: Major
                    Found in app/assets/javascripts/standard/dragdrop.js and 3 other locations - About 1 hr to fix
                    app/assets/javascripts/standard/dragdrop.js on lines 384..384
                    app/assets/javascripts/standard/dragdrop.js on lines 385..385
                    app/assets/javascripts/standard/dragdrop.js on lines 387..387

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

                    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

                        afterUpdateInternal: function(effect) {
                          effect.element.down().setStyle({bottom:
                            (effect.dims[0] - effect.element.clientHeight) + 'px' });
                        },
                    Severity: Major
                    Found in app/assets/javascripts/standard/effects.js and 1 other location - About 1 hr to fix
                    app/assets/javascripts/standard/effects.js on lines 698..701

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

                    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 updatePage has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function updatePage(page, fromPage)
                    {
                        if (!page.id)
                            page.id = "__" + (++newPageCount) + "__";
                    
                    
                    Severity: Minor
                    Found in public/iui/iui.js - About 1 hr to fix

                      Function ajax has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          ajax: function(url, args, method, cb)
                          {
                              var xhr = new XMLHttpRequest();
                              method = method ? method.toUpperCase() : "GET";
                              if (args && method == "GET")
                      Severity: Minor
                      Found in public/iui/iui.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language