angelakuo/citydogshare

View on GitHub

Showing 3,976 of 3,976 total issues

Perceived complexity for update is too high. [11/7]
Open

  def update
    @event = Event.find(params[:id])
    if not @is_admin and @event.user != @current_user
      flash[:notice] = "You may not edit another person's event."
      redirect_to events_path

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Function nextPosition has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          nextPosition: function(position) {
            var
              positions          = position.split(' '),
              verticalPosition   = positions[0],
              horizontalPosition = positions[1],

    Function open has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            open: function(query) {
              var
                $activeTitle = (query !== undefined)
                  ? (typeof query === 'number')
                    ? $title.eq(query)

      Function getJasmineRequireObj has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var getJasmineRequireObj = (function (jasmineGlobal) {
        var jasmineRequire;
      
        if (typeof module !== 'undefined' && module.exports && typeof exports !== 'undefined') {
          if (typeof global !== 'undefined') {

        Function createToast has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function createToast(html) {
        
                // Create toast
                var toast = document.createElement('div');
                toast.classList.add('toast');

          Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              parse: function( red, green, blue, alpha ) {
                  if ( red === undefined ) {
                      this._rgba = [ null, null, null, null ];
                      return this;
                  }

            Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                parse: function( red, green, blue, alpha ) {
                    if ( red === undefined ) {
                        this._rgba = [ null, null, null, null ];
                        return this;
                    }

              Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  parse: function( red, green, blue, alpha ) {
                      if ( red === undefined ) {
                          this._rgba = [ null, null, null, null ];
                          return this;
                      }

                Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    parse: function( red, green, blue, alpha ) {
                        if ( red === undefined ) {
                            this._rgba = [ null, null, null, null ];
                            return this;
                        }

                  Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      parse: function( red, green, blue, alpha ) {
                          if ( red === undefined ) {
                              this._rgba = [ null, null, null, null ];
                              return this;
                          }

                    Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        parse: function( red, green, blue, alpha ) {
                            if ( red === undefined ) {
                                this._rgba = [ null, null, null, null ];
                                return this;
                            }

                      Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          parse: function( red, green, blue, alpha ) {
                              if ( red === undefined ) {
                                  this._rgba = [ null, null, null, null ];
                                  return this;
                              }

                        Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            parse: function( red, green, blue, alpha ) {
                                if ( red === undefined ) {
                                    this._rgba = [ null, null, null, null ];
                                    return this;
                                }

                          Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              parse: function( red, green, blue, alpha ) {
                                  if ( red === undefined ) {
                                      this._rgba = [ null, null, null, null ];
                                      return this;
                                  }

                            Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                parse: function( red, green, blue, alpha ) {
                                    if ( red === undefined ) {
                                        this._rgba = [ null, null, null, null ];
                                        return this;
                                    }

                              Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  parse: function( red, green, blue, alpha ) {
                                      if ( red === undefined ) {
                                          this._rgba = [ null, null, null, null ];
                                          return this;
                                      }

                                Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    parse: function( red, green, blue, alpha ) {
                                        if ( red === undefined ) {
                                            this._rgba = [ null, null, null, null ];
                                            return this;
                                        }

                                  Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      parse: function( red, green, blue, alpha ) {
                                          if ( red === undefined ) {
                                              this._rgba = [ null, null, null, null ];
                                              return this;
                                          }

                                    Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        parse: function( red, green, blue, alpha ) {
                                            if ( red === undefined ) {
                                                this._rgba = [ null, null, null, null ];
                                                return this;
                                            }

                                      Function parse has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          parse: function( red, green, blue, alpha ) {
                                              if ( red === undefined ) {
                                                  this._rgba = [ null, null, null, null ];
                                                  return this;
                                              }
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language