Floppy/carbon-diet

View on GitHub

Showing 215 of 292 total issues

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

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

                              if (form.onsubmit() == true)
                              {
                                  form.submit();
                              }
          Severity: Major
          Found in public/iui/iui.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 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 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 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

                  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

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

                      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 ( !inplace ) {
                                                curLoop = result;
                                            }
                        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

                          Avoid deeply nested control flow statements.
                          Open

                                  if session[:next].include? "http://support.carbondiet.org"
                                    redirect_to "#{session[:next]}?sso=#{CGI.escape(user.multipass)}"
                                  else
                                    redirect_to(session[:next])
                                  end
                          Severity: Major
                          Found in app/controllers/user_controller.rb - About 45 mins to fix

                            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

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

                            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

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

                              create: function(element) {
                                element = $(element);
                                var options = Object.extend({
                                  element:     element,
                                  tag:         'li',       // assumes li children, override with tag: 'tagname'
                            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

                            Severity
                            Category
                            Status
                            Source
                            Language