fga-gpp-mds/2017.1-Escola-X

View on GitHub
app/controllers/principal_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage

Showing 45 of 45 total issues

PrincipalController tests '( is_principal? )' at least 3 times
Open

if ( is_principal? )
@principal = Employee.find(params[:id])
end
end
 
 

PrincipalController assumes too much for instance variable '@principal'
Open

class PrincipalController < ApplicationController

PrincipalController has no descriptive comment
Open

class PrincipalController < ApplicationController

Extra empty line detected at method body end.
Open

 
end

Space inside parentheses detected.
Open

if ( is_principal? )

Tab detected.
Open

:name,

Don't use parentheses around the condition of an if.
Open

if ( is_principal? )

Don't use parentheses around a method call.
Open

if ( is_principal? )

Space inside parentheses detected.
Open

if ( is_principal? )

Space inside parentheses detected.
Open

if ( @principal.update(principal_params) )

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

if ( is_principal? )

Indent access modifiers like private.
Open

private

Space inside parentheses detected.
Open

if ( @principal.update(principal_params) )

Tab detected.
Open

:password,

Don't use parentheses around a method call.
Open

if ( is_principal? )

Align the parameters of a method call if they span more than one line.
Open

:name,

Keep a blank line before and after private.
Open

private

Don't use parentheses around the condition of an if.
Open

if ( @principal.update(principal_params) )

Tab detected.
Open

:phone,

Don't use parentheses around the condition of an if.
Open

if ( is_principal? )

Tab detected.
Open

:admission_date,

Align the parameters of a method call if they span more than one line.
Open

:employee_cpf,

Space inside parentheses detected.
Open

if ( is_principal? )

Tab detected.
Open

:gender,

Missing top-level class documentation comment.
Open

class PrincipalController < ApplicationController

Tab detected.
Open

:employee_cpf,

Align the parameters of a method call if they span more than one line.
Open

:phone,

Align the parameters of a method call if they span more than one line.
Open

:gender,

Space inside parentheses detected.
Open

if ( is_principal? )

Tab detected.
Open

end

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

if ( is_principal? )

Align the parameters of a method call if they span more than one line.
Open

:password,

Align the parameters of a method call if they span more than one line.
Open

:birth_date)

Space inside parentheses detected.
Open

if ( is_principal? )

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

if ( is_principal? )

Don't use parentheses around the condition of an if.
Open

if ( is_principal? )

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

flash[:notice] = "Diretor(a) alterado(a) com sucesso"

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

if ( is_principal? )

end at 40, 3 is not aligned with def at 30, 2.
Open

end

Don't use parentheses around a method call.
Open

if ( @principal.update(principal_params) )

Align the parameters of a method call if they span more than one line.
Open

:admission_date,

Space inside parentheses detected.
Open

if ( is_principal? )

Tab detected.
Open

:birth_date)

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

if ( is_principal? )

Don't use parentheses around a method call.
Open

if ( is_principal? )
Category
Status