hummingbird-me/hummingbird

View on GitHub

Showing 419 of 859 total issues

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

  def self.create_or_update_from_hash(hash)
    character = Character.find_by(mal_id: hash[:external_id])

    # NOTE: Ideally we'd find by name+series but that doesn't seem possible
    # Should we name+role?
Severity: Minor
Found in app/models/character.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

Consider simplifying this complex logical expression.
Open

    if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
      params.contentType = 'application/json';
      params.data = JSON.stringify(options.attrs || model.toJSON(options));
    }
Severity: Major
Found in app/assets/javascripts/old/backbone-1.0.0.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

                if(
                    inst.options.greedy &&
                    !inst.options.disabled &&
                    inst.options.scope === draggable.options.scope &&
                    inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) &&
    Severity: Major
    Found in app/assets/javascripts/old/jquery-ui-custom-1.10.3.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

                  if ( ( this.options.values.length === 2 && this.options.range === true ) &&
                          ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
                      ) {
                      newVal = otherVal;
                  }
      Severity: Major
      Found in app/assets/javascripts/old/jquery-ui-custom-1.10.3.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                if ( tab.hasClass( "ui-state-disabled" ) ||
                        // tab is already loading
                        tab.hasClass( "ui-tabs-loading" ) ||
                        // can't switch durning an animation
                        this.running ||
        Severity: Major
        Found in app/assets/javascripts/old/jquery-ui-custom-1.10.3.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                similar_anime.push(sim) if sim &&
                                           similar_anime.length < limit &&
                                           (!self.sfw? || (self.sfw? && sim.sfw?)) &&
                                           !exclude.include?(sim)
          Severity: Major
          Found in app/models/anime.rb - About 40 mins to fix

            Function init has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                init : function (scope, libraries, method, options, response) {
            Severity: Minor
            Found in public/2013/assets/js/foundation/foundation.js - About 35 mins to fix

              Function ho has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  ho: function(val, cx, partials, text, tags) {
              Severity: Minor
              Found in app/assets/javascripts/old/hogan-2.0.0.js - About 35 mins to fix

                Function _dialogDatepicker has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    _dialogDatepicker: function(input, date, onSelect, settings, pos) {
                Severity: Minor
                Found in app/assets/javascripts/old/jquery-ui-custom-1.10.3.js - About 35 mins to fix

                  Function init has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      init : function (scope, libraries, method, options, response) {
                  Severity: Minor
                  Found in public/2014/assets/js/foundation/foundation.js - About 35 mins to fix

                    Function substituteTimeAgo has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        function substituteTimeAgo(string, number, withoutSuffix, isFuture, lang) {
                    Severity: Minor
                    Found in app/assets/javascripts/old/moment.js - About 35 mins to fix

                      Function popEmberData has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        popEmberData: function(key, path, object, store, edQuery) {
                      Severity: Minor
                      Found in frontend/app/utils/preload-store.js - About 35 mins to fix

                        Function scrollHandler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            scrollHandler: function() {
                              var amount, top;
                              top = $(window).scrollTop();
                              amount = Math.abs(top - this.lastScroll);
                              if (top > this.detachPoint) {
                        Severity: Minor
                        Found in app/assets/javascripts/old/header.js - About 35 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 toggleLike has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            toggleLike: function() {
                              if (!this.get('currentUser.isSignedIn')) {
                                return this.transitionTo('sign-up');
                              }
                        
                        
                        Severity: Minor
                        Found in frontend/app/controllers/story.js - About 35 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 update_manga_library_entry_using_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def update_manga_library_entry_using_params(manga_library_entry, params)
                            [:status, :rating, :private, :notes, :chapters_read, :volumes_read, :rereading, :reread_count].each do |x|
                              if params[:manga_library_entry].has_key? x
                                manga_library_entry[x] = params[:manga_library_entry][x]
                              end
                        Severity: Minor
                        Found in app/controllers/manga_library_entries_controller.rb - About 35 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 check_user_authentication has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def check_user_authentication
                              if cookies[OLD_COOKIE]
                                user = User.where(authentication_token: cookies[OLD_COOKIE]).first
                                cookies.delete("auth_token", domain: :all)
                                sign_in(user) if user
                        Severity: Minor
                        Found in lib/auth/helpers.rb - About 35 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 find_for_facebook_oauth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def self.find_for_facebook_oauth(auth, signed_in_resource=nil)
                            # Try to find a user already associated with the Facebook ID.
                            user = User.where(facebook_id: auth.uid).first
                            return user if user
                        
                        
                        Severity: Minor
                        Found in app/models/user.rb - About 35 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 create_or_update_from_hash has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def self.create_or_update_from_hash(hash)
                            person = Person.find_by(mal_id: hash[:external_id])
                            if person.nil? && Person.where(name: hash[:name]).count > 1
                              logger.error "Count not find unique Person by name='#{hash[:name]}'."
                              return
                        Severity: Minor
                        Found in app/models/person.rb - About 35 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 update_library_entry_using_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def update_library_entry_using_params(library_entry, params)
                            [:status, :rating, :private, :episodes_watched, :rewatching, :rewatch_count, :notes].each do |x|
                              if params[:library_entry].has_key? x
                                library_entry[x] = params[:library_entry][x]
                              end
                        Severity: Minor
                        Found in app/controllers/library_entries_controller.rb - About 35 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 follow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def follow
                            authenticate_user!
                            user = User.find(params[:user_id])
                        
                            if user != current_user
                        Severity: Minor
                        Found in app/controllers/users_controller.rb - About 35 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