app/controllers/notifications_controller.rb
# File name: notifications_controller.rb# Class name: NotificationsControllerLine is too long. [88/80]# Description: Controller used to communicate with the proprietary view of notificationsNotificationsController assumes too much for instance variable '@notification'
NotificationsController assumes too much for instance variable '@current_user'class NotificationsController < ApplicationController include SessionsHelper def indexSpace inside parentheses detected.
Don't use parentheses around the condition of an `if`.
Don't use parentheses around a method call. if ( logged_in? ) @notifications = Notification.all elsePrefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500" end end def showUse a guard clause instead of wrapping the code inside a conditional expression.
Don't use parentheses around the condition of an `if`.
Space inside parentheses detected.
Don't use parentheses around a method call. if ( logged_in? ) @notification = Notification.find(params[:id])NotificationsController#show calls '@notification.employee_id' 2 times
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Line is too long. [132/80] @assignee = Employee.exists?(@notification.employee_id) ? Employee.find_by_id(@notification.employee_id).name : "Desconhecido" end end def newNotificationsController tests '( is_employee? )' at least 5 times
Don't use parentheses around the condition of an `if`.
Don't use parentheses around a method call.
Space inside parentheses detected. if ( is_employee? ) @notification = Notification.new elsePrefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500" end end Method has too many lines. [13/10]
NotificationsController#create has approx 7 statements def createSpace inside parentheses detected.
Don't use parentheses around the condition of an `if`.
Don't use parentheses around a method call. if ( is_employee? ) @notification = Notification.new(notification_params) @notification.employee_id = @current_user.id @notification.notification_date = @notification.get_dateDon't use parentheses around a method call.
Don't use parentheses around the condition of an `if`. if (@notification.save)Prefer single-quoted strings when you don't need string interpolation or special symbols. flash[:success] = "A notificação foi criada com sucesso." redirect_to notification_path(@notification) else render new_notification_path end elsePrefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500" end end def editSpace inside parentheses detected.
Don't use parentheses around a method call.
Don't use parentheses around the condition of an `if`. if ( is_employee? ) @notification = Notification.find(params[:id]) elsePrefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500" end end Method has too many lines. [11/10] def updateSpace inside parentheses detected.
Don't use parentheses around a method call.
Don't use parentheses around the condition of an `if`. if ( is_employee? ) @notification = Notification.find(params[:id])Space inside parentheses detected.
Don't use parentheses around a method call.
Don't use parentheses around the condition of an `if`. if ( @notification.update(notification_params) )Prefer single-quoted strings when you don't need string interpolation or special symbols. flash[:notice] = "A notificação foi alterada com sucesso." redirect_to notification_path(@notification) else render edit_notification_path end elsePrefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500" end end def destroyDon't use parentheses around the condition of an `if`.
Space inside parentheses detected.
Don't use parentheses around a method call. if ( is_employee? ) @notification = Notification.find(params[:id]) @notification.destroyPrefer single-quoted strings when you don't need string interpolation or special symbols. flash[:alert] = "Notificação excluĆda com sucesso" redirect_to notifications_path elsePrefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500" end end Keep a blank line before and after `private`. private def notification_paramsSpace inside parentheses detected. params.require(:notification).permit( :title, :motive, :notification_text, :employee_id, :notification_date, :notification_hour) endend