Floppy/carbon-diet

View on GitHub

Showing 292 of 292 total issues

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

    Avoid deeply nested control flow statements.
    Open

                        for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
                            if ( item ) {
                                found = filter( item, match, i, curLoop );
                                var pass = not ^ !!found;
    
    
    Severity: Major
    Found in app/assets/javascripts/standard/prototype.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                      if (!attribute) return null;
      Severity: Major
      Found in app/assets/javascripts/standard/prototype.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if ( !inplace ) {
                                curLoop = result;
                            }
        Severity: Major
        Found in app/assets/javascripts/standard/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 app/assets/javascripts/standard/prototype.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if ( !match ) {
                                    anyFound = found = true;
                                } else if ( match === true ) {
                                    continue;
                                }
            Severity: Major
            Found in app/assets/javascripts/standard/prototype.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if ( a == b ) {
                              hasDuplicate = true;
                          }
              Severity: Major
              Found in app/assets/javascripts/standard/prototype.js - About 45 mins to fix

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

                Avoid deeply nested control flow statements.
                Open

                                    if (form.onsubmit() == true)
                                    {
                                        form.submit();
                                    }
                Severity: Major
                Found in public/iui/iui.js - About 45 mins to fix

                  Function ATTR has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          ATTR: function(match, curLoop, inplace, result, not, isXML){
                  Severity: Minor
                  Found in app/assets/javascripts/standard/prototype.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                              if (node.tagName !== "!") // Filter out comment nodes.
                                results.push(node);
                    Severity: Major
                    Found in app/assets/javascripts/standard/prototype.js - About 45 mins to fix

                      Function CLASS has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              CLASS: function(match, curLoop, inplace, result, not, isXML){
                      Severity: Minor
                      Found in app/assets/javascripts/standard/prototype.js - About 45 mins to fix

                        Function dirCheck has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
                        Severity: Minor
                        Found in app/assets/javascripts/standard/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 app/assets/javascripts/standard/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 dirNodeCheck has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
                          Severity: Minor
                          Found in app/assets/javascripts/standard/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 app/assets/javascripts/standard/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

                            Method fix_missing_date_components has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def fix_missing_date_components
                                if !params[:flight]['return_on(1i)'].blank? || !params[:flight]['return_on(2i)'].blank? || !params[:flight]['return_on(3i)'].blank?
                                  params[:flight]['return_on(1i)'] = params[:flight]['outbound_on(1i)'] if params[:flight]['return_on(1i)'].blank?
                                  params[:flight]['return_on(2i)'] = params[:flight]['outbound_on(2i)'] if params[:flight]['return_on(2i)'].blank?
                                  params[:flight]['return_on(3i)'] = params[:flight]['outbound_on(3i)'] if params[:flight]['return_on(3i)'].blank?
                            Severity: Minor
                            Found in app/controllers/flights_controller.rb - 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

                            Method calculate_total_over_period has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def calculate_total_over_period(days)
                                return { :total => 0, :days => 0, :perday => 0, :perannum => 0 } if self.empty? 
                                total = 0.0
                                dayscounted = 0
                                firstday = Date::today - days
                            Severity: Minor
                            Found in app/models/emission_array.rb - 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

                            Method date_of_first_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def date_of_first_data
                                start = Date::today
                                self.electricity_accounts.each { |x| start = x.start_date if x.start_date < start }
                                self.gas_accounts.each { |x| start = x.start_date if x.start_date < start }
                                self.vehicles.each { |x| start = x.start_date if x.start_date < start }
                            Severity: Minor
                            Found in app/models/user.rb - 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