Floppy/carbon-diet

View on GitHub

Showing 215 of 292 total issues

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

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

          function update(element, content) {
            element = $(element);
            var purgeElement = Element._purgeElement;
      
            var descendants = element.getElementsByTagName('*'),
      Severity: Minor
      Found in app/assets/javascripts/standard/prototype.js - About 1 hr to fix

        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

            Consider simplifying this complex logical expression.
            Open

                        if ( match[1] == "nth" ) {
                            var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
                                match[2] == "even" && "2n" || match[2] == "odd" && "2n+1" ||
                                !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
            
            
            Severity: Critical
            Found in app/assets/javascripts/standard/prototype.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                      if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
                          submit !== false && (!submit || key == submit) && (submitted = true)))) {
                        result = accumulator(result, key, value);
                      }
              Severity: Critical
              Found in app/assets/javascripts/standard/prototype.js - About 1 hr to fix

                Function request has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  request: function(url) {
                    this.url = url;
                    this.method = this.options.method;
                    var params = Object.isString(this.options.parameters) ?
                          this.options.parameters :
                Severity: Minor
                Found in app/assets/javascripts/standard/prototype.js - About 1 hr to fix

                  Function onKeyPress has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    onKeyPress: function(event) {
                      if(this.active)
                        switch(event.keyCode) {
                         case Event.KEY_TAB:
                         case Event.KEY_RETURN:
                  Severity: Minor
                  Found in app/assets/javascripts/standard/controls.js - About 1 hr to fix

                    Function selector has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          selector: function(instance) {
                            var ret       = []; // Beginning matches
                            var partial   = []; // Inside matches
                            var entry     = instance.getToken();
                            var count     = 0;
                    Severity: Minor
                    Found in app/assets/javascripts/standard/controls.js - About 1 hr to fix

                      Method emissions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def emissions
                          # Initialise result array
                          emission_array = EmissionArray.new
                          # Create "last reading" trackers
                          last_m3 = 0;
                      Severity: Minor
                      Found in app/models/gas_account.rb - About 1 hr to fix

                        Function draw has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          draw: function(point) {
                            var pos = this.element.cumulativeOffset();
                            if(this.options.ghosting) {
                              var r   = Position.realOffset(this.element);
                              pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
                        Severity: Minor
                        Found in app/assets/javascripts/standard/dragdrop.js - About 1 hr to fix

                          Function respondToReadyState has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            respondToReadyState: function(readyState) {
                              var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
                          
                              if (state == 'Complete') {
                                try {
                          Severity: Minor
                          Found in app/assets/javascripts/standard/prototype.js - 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 updateChoices has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            updateChoices: function(choices) {
                              if(!this.changed && this.hasFocus) {
                                this.update.innerHTML = choices;
                                Element.cleanWhitespace(this.update);
                                Element.cleanWhitespace(this.update.down());
                          Severity: Minor
                          Found in app/assets/javascripts/standard/controls.js - 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 createEditField has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            createEditField: function() {
                              var text = (this.options.loadTextURL ? this.options.loadingText : this.getText());
                              var fld;
                              if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) {
                                fld = document.createElement('input');
                          Severity: Minor
                          Found in app/assets/javascripts/standard/controls.js - 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 setOpacity has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            Element.Methods.setOpacity = function(element, value) {
                              function stripAlpha(filter){
                                return filter.replace(/alpha\([^\)]*\)/gi,'');
                              }
                              element = $(element);
                          Severity: Minor
                          Found in app/assets/javascripts/standard/prototype.js - 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

                          Method edit has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def edit
                              if request.post?      
                                if verify_recaptcha(@group)
                                  @group.update_attributes(params[:group])
                                  if @group.owner.nil?
                          Severity: Minor
                          Found in app/controllers/groups_controller.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 spbhCB has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  function spbhCB(xhr) 
                                  {
                                      log("xhr.readyState = " + xhr.readyState);
                                      if (xhr.readyState == 4)
                                      {
                          Severity: Minor
                          Found in public/iui/iui.js - About 1 hr to fix

                            Function slide1 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function slide1(fromPage, toPage, backwards, axis, cb)
                            {
                                if (axis == "y")
                                    (backwards ? fromPage : toPage).style.top = "100%";
                                else
                            Severity: Minor
                            Found in public/iui/iui.js - About 1 hr to fix

                              Method post has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def post
                                  # Create comment
                                  comment = Comment.new
                                  comment.commentable_type =  params[:comment][:commentable_type]
                                  case comment.commentable_type
                              Severity: Minor
                              Found in app/controllers/comments_controller.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language