assemblymade/coderwall

View on GitHub

Showing 189 of 189 total issues

Class NotifierMailer has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

class NotifierMailer < ApplicationMailer
  add_template_helper(UsersHelper)
  add_template_helper(ProtipsHelper)
  add_template_helper(ApplicationHelper)
  add_template_helper(AccountsHelper)
Severity: Minor
Found in app/mailers/notifier_mailer.rb - About 2 hrs to fix

    Class UsersController has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class UsersController < ApplicationController
      after_action :track_referrer, only: :show
      skip_before_action :require_registration, only: [:edit, :update]
    
      layout 'coderwallv2', only: :edit
    Severity: Minor
    Found in app/controllers/users_controller.rb - About 2 hrs to fix

      Class V1 has 24 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class V1 < Bitbucket
      
          PROTOCOL = "https"
          API_URL  = "api.bitbucket.org/1.0"
          WEB_URL  = "bitbucket.org"
      Severity: Minor
      Found in app/structs/bitbucket.rb - About 2 hrs to fix

        Class Skill has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Skill < ActiveRecord::Base
          never_wastes
        
          SPACE = ' '
          BLANK = ''
        Severity: Minor
        Found in app/models/skill.rb - About 2 hrs to fix

          Class OpportunitiesController has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class OpportunitiesController < ApplicationController
            before_action :lookup_team, only: [:activate, :deactivate, :new, :create, :edit, :update, :visit]
            before_action :lookup_opportunity, only: [:edit, :update, :activate, :deactivate, :visit]
            before_action :cleanup_params_to_prevent_tagging_error
            before_action :validate_permissions, only: [:new, :edit, :create, :update, :activate, :deactivate]
          Severity: Minor
          Found in app/controllers/opportunities_controller.rb - About 2 hrs to fix

            Class Network has 23 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Network < ActiveRecord::Base
              has_closure_tree order: :slug
            
              acts_as_taggable
              acts_as_followable
            Severity: Minor
            Found in app/models/network.rb - About 2 hrs to fix

              Method user_activity has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def user_activity(user, from, to, limit, publish=false)
              
                    activity_feed_keys = user.nil? ? Audience.to_key(Audience.all).to_a : user.subscribed_channels.map { |channel| Audience.channel_to_key(channel) }
                    count              = 0
                    from               = from.nil? ? "-inf" : from.to_f
              Severity: Minor
              Found in app/structs/event.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

              File users_controller.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class UsersController < ApplicationController
                after_action :track_referrer, only: :show
                skip_before_action :require_registration, only: [:edit, :update]
              
                layout 'coderwallv2', only: :edit
              Severity: Minor
              Found in app/controllers/users_controller.rb - About 2 hrs to fix

                File application_controller.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class ApplicationController < ActionController::Base
                  protect_from_forgery
                
                  APP_DOMAIN = 'coderwall.com'
                
                
                Severity: Minor
                Found in app/controllers/application_controller.rb - About 2 hrs to fix

                  Class Audience has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Audience
                    def self.all
                      { all: nil }
                    end
                  
                  
                  Severity: Minor
                  Found in app/structs/audience.rb - About 2 hrs to fix

                    File teams_controller.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    class TeamsController < ApplicationController
                      skip_before_action :require_registration, :only => [:accept, :record_exit]
                      before_action :access_required, :except => [:index, :show, :new, :inquiry, :search, :create, :record_exit]
                      before_action :ensure_analytics_access, :only => [:visitors]
                      respond_to :js, :only => [:search, :create, :approve_join, :deny_join]
                    Severity: Minor
                    Found in app/controllers/teams_controller.rb - About 2 hrs to fix

                      Method all has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def self.all
                          [
                            ::Beaver,
                      
                            ::Beaver3,
                      Severity: Minor
                      Found in app/badges/badges.rb - About 1 hr to fix

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

                          def edit
                            respond_to do |format|
                              format.json do
                                settings
                              end
                        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

                        Method perform has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def perform(username, ip_address)
                            user = User.find_by_username(username)
                            unless user.nil? or user.ip_lat
                              geocoder = MaxMind.new
                              begin
                        Severity: Minor
                        Found in app/jobs/reverse_geolocate_user_job.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 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def update
                        
                            user_id = params[:id]
                        
                            @user = user_id.blank? ? current_user : User.find(user_id)
                        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

                        Method load_badges has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def load_badges
                              (2012..2020).each do |year|
                                Object.const_set "GithubGameoffJudge#{year}", Class.new(BadgeBase) {
                                  describe "Github Gameoff Judge",
                                           skill:       'game development',
                        Severity: Minor
                        Found in app/badges/github_gameoff.rb - About 1 hr to fix

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

                              def aggregate_visitors(since = 0)
                                aggregate = {}
                                visitors(since).map do |visitor|
                                  user_id = visitor[:user_id].to_i
                                  aggregate[user_id] ||= visitor
                          Severity: Minor
                          Found in app/models/concerns/team_analytics.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 startGui has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function startGui() {
                              inputPane = $('.x-tip-content.edit #protip_body')[0];
                              previewPane = $('.x-tip-content.preview #body')[0];
                          
                              // if (typeof previewPane === "undefined") 
                          Severity: Minor
                          Found in app/assets/javascripts/showdown-gui.js - About 1 hr to fix

                            Method save_with_payment has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def save_with_payment(plan=nil)
                                if stripe_card_token
                                  create_customer unless plan.try(:one_time?)
                                  subscribe_to!(plan) unless plan.nil?
                                  save!
                            Severity: Minor
                            Found in app/models/teams/account.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 create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def create
                                #FIXME
                                raise "OmniAuth returned error #{params[:error]}" unless params[:error].blank?
                                if signed_in?
                                  current_user.apply_oauth(oauth)
                            Severity: Minor
                            Found in app/controllers/sessions_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

                            Severity
                            Category
                            Status
                            Source
                            Language