swamp09/sample_app

View on GitHub

Showing 3 of 3 total issues

Class User has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

class User < ApplicationRecord
has_many :microposts, dependent: :destroy
 
has_many :active_relationships, class_name: 'Relationship', foreign_key: 'follower_id', dependent: :destroy
has_many :passive_relationships, class_name: 'Relationship', foreign_key: 'followed_id', dependent: :destroy
Severity: Minor
Found in app/models/user.rb - About 2 hrs to fix

    Method create has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def create
    user = User.find_by(email: params[:session][:email].downcase)
    if user && user.authenticate(params[:session][:password])
    if user.activated?
    log_in user
    Severity: Minor
    Found in app/controllers/sessions_controller.rb - About 1 hr to fix

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

    def current_user
    if (user_id = session[:user_id])
    @current_user ||= User.find_by(id: user_id)
    elsif (user_id = cookies.signed[:user_id])
    user = User.find_by(id: user_id)
    Severity: Minor
    Found in app/helpers/sessions_helper.rb - About 25 mins to fix
    Severity
    Category
    Status
    Source
    Language