app/controllers/teachers_controller.rb
require 'set' Class has too many lines. [107/100]
TeachersController has at least 9 instance variables
TeachersController assumes too much for instance variable '@classroom'
TeachersController assumes too much for instance variable '@classrooms'
TeachersController has no descriptive comment
TeachersController assumes too much for instance variable '@subject'
TeachersController assumes too much for instance variable '@teacher'
TeachersController assumes too much for instance variable '@classroom_subjects'
TeachersController assumes too much for instance variable '@subjects'
Missing top-level class documentation comment.class TeachersController < ApplicationControllerExtra empty line detected at class body beginning. 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 ( is_employee? ) @teachers = Teacher.all elseUse 2 (not 4) spaces for indentation.
Prefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500" end end def showDon't use parentheses around the condition of an `if`.
Don't use parentheses around a method call.
Space inside parentheses detected. if ( is_employee? ) @teacher = Teacher.find(params[:id]) elsePrefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500" end end def newTeachersController tests '( is_principal? )' at least 5 times
Space inside parentheses detected.
Don't use parentheses around a method call.
Don't use parentheses around the condition of an `if`. if ( is_principal? ) @shifts = Shift.all @teacher = Teacher.new 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_principal? ) @shifts = Shift.all @teacher = Teacher.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. [12/10]
TeachersController#create has approx 6 statements def createDon't use parentheses around a method call.
Space inside parentheses detected.
Don't use parentheses around the condition of an `if`. if ( is_principal? ) @shifts = Shift.all @teacher = Teacher.new(teacher_params)Don't use parentheses around a method call.
Don't use parentheses around the condition of an `if`. if (@teacher.save)Prefer single-quoted strings when you don't need string interpolation or special symbols. flash[:success] = "Professor(a) criado(a) com sucesso" redirect_to users_path else render 'new' end 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. [12/10]
TeachersController#update has approx 6 statements
Similar blocks of code found in 2 locations. Consider refactoring. def updateDon't use parentheses around a method call.
Don't use parentheses around the condition of an `if`.
Space inside parentheses detected. if ( is_principal? ) @shifts = Shift.all @teacher = Teacher.find(params[:id])Don't use parentheses around the condition of an `if`.
Space inside parentheses detected.
Don't use parentheses around a method call. if ( @teacher.update(teacher_params) )Prefer single-quoted strings when you don't need string interpolation or special symbols. flash[:notice] = "Professor(a) alterado(a) com sucesso" redirect_to @teacher else render 'edit' end elsePrefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500" end end def destroySpace inside parentheses detected.
Don't use parentheses around the condition of an `if`.
Don't use parentheses around a method call. if ( is_principal? ) @teacher = Teacher.find(params[:id]) @teacher.destroyPrefer single-quoted strings when you don't need string interpolation or special symbols. flash[:alert] = "Professor(a) excluÃdo(a) com sucesso" redirect_to users_path elsePrefer single-quoted strings when you don't need string interpolation or special symbols. redirect_to "/errors/error_500" end end TeachersController#teacher_classrooms has approx 6 statements def teacher_classroomsPrefer single-quoted strings when you don't need string interpolation or special symbols. @subjects = Subject.where("teacher_id = ?", params[:id]) @classrooms = Set.new @subjects.each do |subject|Prefer single-quoted strings when you don't need string interpolation or special symbols. relations = ClassroomSubject.where("subject_id = ?", subject.id)TeachersController#teacher_classrooms contains iterators nested 2 deep relations.each do |relation| @classrooms.add(Classroom.find_by_id(relation.classroom_id)) end end end def teacher_classroom_subjectsPrefer single-quoted strings when you don't need string interpolation or special symbols. @subjects = Subject.where("teacher_id = ?", params[:teacher_id]) @classroom_subjects = [] @subjects.each do |subject| @classroom_subjects << subject end end def teacher_grades @classroom = Classroom.find(params[:classroom_id]) @subject = Subject.find(params[:subject_id])Line is too long. [85/80] @grades = Grade.where(classroom_id: @classroom.id).where(subject_id: @subject.id) end Keep a blank line before and after `private`.
Indent access modifiers like `private`.privateMethod has too many lines. [12/10] def teacher_params params.require(:teacher).permit(:registry,Align the parameters of a method call if they span more than one line. :admission_date,Align the parameters of a method call if they span more than one line. :employee_cpf,Align the parameters of a method call if they span more than one line. :shift,Align the parameters of a method call if they span more than one line. :password,Align the parameters of a method call if they span more than one line. :name,Align the parameters of a method call if they span more than one line. :address,Align the parameters of a method call if they span more than one line. :phone,Align the parameters of a method call if they span more than one line. :gender,Align the parameters of a method call if they span more than one line. :birth_date,Align the parameters of a method call if they span more than one line. :admission_date,Align the parameters of a method call if they span more than one line. :shift_id) endend