asm-products/gamamia

View on GitHub

Showing 15 of 15 total issues

Function MentionsInput has 295 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var MentionsInput = function (settings) {

    var domInput, 
    elmInputBox, 
    elmInputWrapper, 
Severity: Major
Found in app/assets/javascripts/lib/jquery-mentions.js - About 1 day to fix

    File jquery-mentions.js has 369 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Mentions Input
     * Version 1.0.2
     * Written by: Kenneth Auchenberg (Podio)
     *
    Severity: Minor
    Found in app/assets/javascripts/lib/jquery-mentions.js - About 4 hrs to fix

      Method find_for_oauth has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.find_for_oauth(auth, signed_in_resource = nil)
      
          # Get the identity and user if they exist
          identity = Identity.find_for_oauth(auth)
      
      
      Severity: Minor
      Found in app/models/user.rb - About 2 hrs 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 populateDropdown has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function populateDropdown(query, results) {
            elmAutocompleteList.show(); //Shows the autocomplete list
      
            if(!settings.allowRepeat) {
              // Filter items that has already been mentioned
      Severity: Minor
      Found in app/assets/javascripts/lib/jquery-mentions.js - About 1 hr to fix

        Function onInputBoxKeyDown has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function onInputBoxKeyDown(e) {
        
              // This also matches HOME/END on OSX which is CMD+LEFT, CMD+RIGHT
              if (e.keyCode === KEY.LEFT || e.keyCode === KEY.RIGHT || e.keyCode === KEY.HOME || e.keyCode === KEY.END) {
                // Defer execution to ensure carat pos has changed after HOME/END keys then call the resetBuffer function
        Severity: Minor
        Found in app/assets/javascripts/lib/jquery-mentions.js - About 1 hr to fix

          Method finish_signup has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def finish_signup
              #authorize! :update, @user
              @user.email = nil if !@user.email_verified?
              if request.patch? && params[:user]
                if @user.update(user_params)
          Severity: Minor
          Found in app/controllers/users_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 setup has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              setup: function(data, namespaces) {
                var timer,
                  // Get a reference to the element
                  elem = this,
                  // Store the current state of the element
          Severity: Minor
          Found in app/assets/javascripts/lib/jquery.events.input.js - About 1 hr to fix

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

              def avatar_for(user, size)
                return unless user
                avatar_url = if user.avatar_url.nil?
                  avatar_path = Digest::MD5.hexdigest(user.email.downcase)
                  if size == 'small'
            Severity: Minor
            Found in app/helpers/user_helper.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

            Method update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def update
                # authorize! :update, @user
                respond_to do |format|
                  if @user.update(user_params)
                    sign_in(@user == current_user ? @user : current_user, :bypass => true)
            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

            Avoid too many return statements within this function.
            Open

                  return true;
            Severity: Major
            Found in app/assets/javascripts/lib/jquery-mentions.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return false;
              Severity: Major
              Found in app/assets/javascripts/lib/jquery-mentions.js - About 30 mins to fix

                Method cache_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def cache_content
                    context = {
                        asset_root: 'https://a248.e.akamai.net/assets.github.com/images/icons/',
                        base_url: '/users/'
                    }
                Severity: Minor
                Found in app/models/comment.rb - About 25 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 upvote has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def upvote
                    if @game.scheduled_at?
                      @game.upvote_by(current_user)
                    else
                      flash[:error] = "Sorry. You can't vote on unpublished games"
                Severity: Minor
                Found in app/controllers/games_controller.rb - About 25 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 mention_emails has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def mention_emails
                    HTML::Pipeline::MentionFilter.mentioned_logins_in(content) do |mention|
                      pre = mention[0] == "@" ? "" : mention.slice!(0)
                      mention_user = User.find_for_mention(mention)
                
                
                Severity: Minor
                Found in app/models/comment.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def index
                    @current_week = params[:week].present? ? Date.parse(params[:week]) : Date.today.beginning_of_week
                    @last_week = @current_week - 7.days
                    @next_week = @current_week + 7.days
                
                
                Severity: Minor
                Found in app/controllers/games_controller.rb - About 25 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