hummingbird-me/hummingbird

View on GitHub

Showing 419 of 859 total issues

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

FastClick.prototype.onMouse = function(event) {
    'use strict';

    // If a target element was never set (because a touch event was never fired) allow the event
    if (!this.targetElement) {
Severity: Minor
Found in public/2013/assets/js/fastclick.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 ((callback && callback !== ev.callback && callback !== ev.callback._callback) ||
                  (context && context !== ev.context)) {
                retain.push(ev);
              }
Severity: Major
Found in app/assets/javascripts/old/backbone-1.0.0.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                  if (type == _click) {
                    operate(self, false, true);
    
                  // Hover state
                  } else if (labelHover) {
    Severity: Major
    Found in app/assets/javascripts/old/jquery.icheck.js - About 45 mins to fix

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

        function section(nodes, id, method, start, end, tags) {
      Severity: Minor
      Found in app/assets/javascripts/old/hogan-2.0.0.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (lookAhead("'")) {
                                        output += "'";
                                    } else {
                                        literal = true;
                                    }
        Severity: Major
        Found in app/assets/javascripts/old/jquery-ui-custom-1.10.3.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  switch (col) {
                                      case 0: calender += " ui-datepicker-group-first";
                                          cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
                                      case numMonths[1]-1: calender += " ui-datepicker-group-last";
                                          cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
          Severity: Major
          Found in app/assets/javascripts/old/jquery-ui-custom-1.10.3.js - About 45 mins to fix

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

            export function avatar(user, size) {
              var avatarUrl = user.get("avatarTemplate").replace('{size}', size);
              if (size !== "thumb") {
                const pattern = /\.[a-zA-Z]+\?/;
                // handle Facebook/weird case
            Severity: Minor
            Found in frontend/app/helpers/avatar.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(data) { data.key = key; }
            Severity: Major
            Found in app/assets/javascripts/old/handlebars-1.0.0.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if (this.terminals_[p] && p > 2) {
                                      expected.push("'" + this.terminals_[p] + "'");
                                  }
              Severity: Major
              Found in app/assets/javascripts/old/handlebars-1.0.0.js - About 45 mins to fix

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

                  invokePartial: function(partial, name, context, helpers, partials, data) {
                Severity: Minor
                Found in app/assets/javascripts/old/handlebars-1.0.0.js - About 45 mins to fix

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

                    franchiseAnime: function() {
                      var anime = [];
                      this.getEach("anime").forEach(function(animeSet) {
                        anime = anime.concat(animeSet.toArray());
                      });
                  Severity: Minor
                  Found in frontend/app/controllers/franchises.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def create
                      return error! "Invalid message type", 400 unless params[:type].in?(['message', 'action', 'notice', nil])
                      return error! "Message is required", 400 unless params.has_key?(:message)
                      return error! "Not an administrator", 403 if params[:type] == 'notice' && !current_user.admin?
                      return error! "User is banned", 403 if current_user.ninja_banned?
                  Severity: Minor
                  Found in app/controllers/chats_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 destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def destroy
                      return error! "Mods can only remove regular users from the group", 403 unless current_user.admin? || current_member.admin? || (current_member.mod? && membership.pleb?) || current_user.id == membership.user_id
                      return error! "You must promote another admin", 400 if membership.admin? && !group.can_admin_resign?
                      return error! "Wrong user", 403 if current_member.pleb? && current_user.id != membership.user_id
                  
                  
                  Severity: Minor
                  Found in app/controllers/group_members_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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def create
                      params.permit(:token, :plan_id, :gift, :gift_to, :gift_message)
                  
                      if params[:token].blank?
                        return render(text: "Didn't get credit card details from Stripe", status: 400)
                  Severity: Minor
                  Found in app/controllers/pro_memberships_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 embed_media has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def embed_media
                      html = Nokogiri::HTML.fragment(@processed)
                      html.css("a").each do |a|
                        href = a["href"]
                        next if href =~ IMAGE_REGEX && filesize(href) > MAX_IMAGE_FILE_SIZE
                  Severity: Minor
                  Found in app/services/message_formatter.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 index has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def index
                      if params[:followed_by] || params[:followers_of]
                        if params[:followed_by]
                          users = User.find(params[:followed_by]).following
                        elsif params[:followers_of]
                  Severity: Minor
                  Found in app/controllers/users_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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def update
                      authenticate_user!
                  
                      user = User.find(params[:id])
                      changes = params[:current_user] || params[:user]
                  Severity: Minor
                  Found in app/controllers/users_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 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)
                      person = Person.create_or_update_from_hash(hash) unless hash[:name].blank?
                  
                      if hash[:character] ### Voice Actor
                        # TODO: overwrite castings when adding the first voice actor if there's already a casting
                  Severity: Minor
                  Found in app/models/casting.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 each has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def each
                      status_map = "ListImport::MyAnimeList::#{@media_type.upcase}_STATUS_MAP".constantize
                      @data.each do |row|
                        mal_id = (row['series_animedb_id'] || row['manga_mangadb_id']).to_i
                        media = @db.where(mal_id: mal_id).first
                  Severity: Minor
                  Found in lib/list_imports/myanimelist.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 recompute_bayesian_ratings! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def recompute_bayesian_ratings!
                        #
                        # Bayesian rating:
                        #
                        #     r * v / (v + m) + c * m / (v + m)
                  Severity: Minor
                  Found in app/models/concerns/bayesian_averageable.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