app/controllers/suspensions_controller.rb
# File name: suspensions_controller.rb# Class name: SuspensionsControllerLine is too long. [86/80]# Description: Controller used to communicate with the proprietary view of suspensionsSuspensionsController assumes too much for instance variable '@current_user'
SuspensionsController assumes too much for instance variable '@suspension'
SuspensionsController assumes too much for instance variable '@alumn'class SuspensionsController < ApplicationControllerUse 2 (not 1) spaces for indentation.
Tab detected. include SessionsHelper Cyclomatic complexity for index is too high. [4/3]
Tab detected. def indexUse 2 (not 0) spaces for indentation.
Tab detected. id = params[:alumn_id] Use `||` instead of `or`.
Space inside parentheses detected.
Inconsistent indentation detected.
Don't use parentheses around the condition of an `if`. if ( is_employee? or verify_alumn(id) or is_son?(id) )SuspensionsController declares the class variable '@@alumn'
Tab detected.
Replace class var @@alumn with a class instance var.
Use 2 (not 3) spaces for indentation. @@alumn = Alumn.find(id)Tab detected.
Inconsistent indentation detected. @suspensions = @@alumn.suspensionsTab detected.
Align `else` with `if`. elseUse 2 (not 5) spaces for indentation.
Prefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500" end`end` at 16, 2 is not aligned with `def` at 7, 1. end Tab detected. def newSuspensionsController tests '( is_principal? )' at least 5 times
Use 2 (not 1) spaces for indentation.
Space inside parentheses detected.
Don't use parentheses around the condition of an `if`.
Tab detected.
Don't use parentheses around a method call. if ( is_principal? )Use 2 (not 1) spaces for indentation.
Tab detected.
Replace class var @@alumn with a class instance var. @@alumn = Alumn.find(params[:alumn_id])Tab detected. @suspension = Suspension.newTab detected. elseUse 2 (not 6) spaces for indentation.
Tab detected.
Prefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500"Tab detected. endTab detected. end Tab detected. def showTab detected.
Don't use parentheses around the condition of an `if`.
Space inside parentheses detected.
Don't use parentheses around a method call.
Use 2 (not 1) spaces for indentation.
Use a guard clause instead of wrapping the code inside a conditional expression. if ( logged_in? )Tab detected.
Use 2 (not 1) spaces for indentation. @suspension = Suspension.find(params[:id])Tab detected. @alumn = Alumn.find_by_id(@suspension.alumn_id)Tab detected. @employee = Employee.find(@suspension.employee_id)Tab detected. endTab detected. end Method has too many lines. [17/10]
Cyclomatic complexity for create is too high. [4/3]
Assignment Branch Condition size for create is too high. [15.81/15]
Method `create` has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
SuspensionsController#create has approx 8 statements
Tab detected. def createSpace inside parentheses detected.
Tab detected.
Space after keyword `if` is missing.
Use 2 (not 1) spaces for indentation. if( is_principal? )Tab detected.
Use 2 (not 1) spaces for indentation. @suspension = @@alumn.suspensions.create(suspension_params)Tab detected. @suspension.employee_id = @current_user.idSpace inside parentheses detected.
Space after keyword `if` is missing.
Tab detected. if( @suspension.save )Tab detected.
Use 2 (not 1) spaces for indentation. @alumn = Alumn.find_by_id(@suspension.alumn_id)Space inside parentheses detected.
Tab detected.
Space after keyword `if` is missing. if( @alumn.save )Tab detected.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Use 2 (not 1) spaces for indentation. flash[:success] = "Suspensão criada com sucesso"Tab detected. redirect_to alumn_path(@alumn)Tab detected. elseSuspensionsController#create calls 'render 'suspensions/new'' 2 times
Use 2 (not 1) spaces for indentation.
Tab detected. render 'suspensions/new'Tab detected. endTab detected. elseUse 2 (not 1) spaces for indentation.
Tab detected. render 'suspensions/new'Tab detected. endTab detected. elseTab detected.
Use 2 (not 3) spaces for indentation.
Prefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500"Tab detected. endTab detected. end Method has too many lines. [12/10]
Cyclomatic complexity for destroy is too high. [4/3]
Method `destroy` has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Tab detected. def destroySpace inside parentheses detected.
Space after keyword `if` is missing.
Tab detected.
Use 2 (not 1) spaces for indentation. if( is_principal? )Use 2 (not 1) spaces for indentation.
Tab detected. @suspension = Suspension.find(params[:id])Tab detected. @alumn = Alumn.find_by_id(@suspension.alumn_id)Space inside parentheses detected.
Tab detected.
Space after keyword `if` is missing. if( @suspension.destroy )Space after keyword `if` is missing.
Space inside parentheses detected.
Tab detected.
Use 2 (not 1) spaces for indentation. if( @alumn.save )Use 2 (not 1) spaces for indentation.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Tab detected. flash[:alert] = "Suspensão excluÃda com sucesso"Tab detected. redirect_to users_pathTab detected. endTab detected. endTab detected. elsePrefer single-quoted strings when you don't need string interpolation or special symbols.
Use 2 (not 6) spaces for indentation.
Tab detected. redirect_to "/errors/error_500"Tab detected. endTab detected. end Tab detected. def editTab detected.
Space after keyword `if` is missing.
Space inside parentheses detected.
Use 2 (not 1) spaces for indentation. if( is_principal? )Tab detected.
Use 2 (not 1) spaces for indentation. @suspension = Suspension.find(params[:id])Tab detected. @alumn = Alumn.find_by_id(@suspension.alumn_id)Tab detected. elseUse 2 (not 6) spaces for indentation.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Tab detected. redirect_to "/errors/error_500"Tab detected. endTab detected. end Method has too many lines. [11/10]
Similar blocks of code found in 2 locations. Consider refactoring.
Tab detected. def updateSpace inside parentheses detected.
Space after keyword `if` is missing.
Use 2 (not 1) spaces for indentation.
Tab detected. if( is_principal? )Tab detected.
Use 2 (not 1) spaces for indentation. @suspension = Suspension.find(params[:id])Space inside parentheses detected.
Space after keyword `if` is missing.
Tab detected. if( @suspension.update(suspension_params) )Tab detected.
Use 2 (not 1) spaces for indentation.
Prefer single-quoted strings when you don't need string interpolation or special symbols. flash[:notice] = "Suspensão alterada com sucesso"Tab detected. redirect_to suspension_path(@suspension)Tab detected. elseUse 2 (not 1) spaces for indentation.
Prefer single-quoted strings when you don't need string interpolation or special symbols.
Tab detected. render "suspensions/edit"Tab detected. endTab detected. elseTab detected.
Use 2 (not 6) spaces for indentation.
Prefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500"Tab detected. endTab detected. end Keep a blank line before and after `private`.
Indent access modifiers like `private`.
Tab detected. privateTab detected. def suspension_paramsUse 2 (not 1) spaces for indentation.
Tab detected. params.require(:suspension).permit(:title,Align the parameters of a method call if they span more than one line. :description,Align the parameters of a method call if they span more than one line. :quantity_days,Align the parameters of a method call if they span more than one line. :employee_id,Align the parameters of a method call if they span more than one line. :alumn_id,Align the parameters of a method call if they span more than one line.
Tab detected. :date_suspension)Tab detected. endend