fga-gpp-mds/2017.1-Escola-X

View on GitHub

Showing 3,213 of 3,213 total issues

Assignment Branch Condition size for update is too high. [19.87/15]
Open

  def update
      if ( is_principal? )
            @classroom_grades = ClassroomGrade.all
            @subject = Subject.find(params[:id])
            @teacher = Teacher.find_by_registry(params[:teacher_registry])

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for current_user is too high. [18.17/15]
Open

  def current_user
    if ( !@current_user.nil? )
      @current_user = @current_user
    else
      if ( !(@current_user = Employee.find_by_authorization_token(cookies[:authorization_token])).nil? )
Severity: Minor
Found in app/helpers/sessions_helper.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [13/10]
Open

  def destroy
    if ( is_employee? )
      @strike = Strike.find(params[:id])
      @alumn = Alumn.find_by_id(@strike.alumn_id)
      if @strike.destroy

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for index is too high. [6/3]
Open

  def index
    if ( is_principal? or is_secretary? )
      @classrooms = Classroom.all.order('name_classroom')
      unless params[:classroom_grade_id].blank?
        @classrooms &= Classroom.where(classroom_grade_id: params[:classroom_grade_id])

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method has too many lines. [13/10]
Open

  def current_user
    if ( !@current_user.nil? )
      @current_user = @current_user
    else
      if ( !(@current_user = Employee.find_by_authorization_token(cookies[:authorization_token])).nil? )
Severity: Minor
Found in app/helpers/sessions_helper.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [13/10]
Open

def update
  if ( is_principal? )
    @classroom = Classroom.find(params[:id])
    @classroom_grades = ClassroomGrade.all
    @shifts = Shift.all

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [13/10]
Open

  def create
    if ( is_principal? )
      @classroom = Classroom.create(classroom_params)
      @classroom_grades = ClassroomGrade.all
      @shifts = Shift.all

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for index is too high. [6/3]
Open

  def index
    if ( is_parent? )
      @alumns = @current_user.alumns
    elsif ( is_employee? )
      @alumns = Alumn.all

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method has too many lines. [13/10]
Open

    def give_presence_to_alumn(date , alumn)
        
        school_misses = nil
        if (alumn != nil)
            school_misses = alumn.school_misses.all

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [13/10]
Open

  def create
    if ( is_employee? )
      @notification = Notification.new(notification_params)
      @notification.employee_id = @current_user.id
      @notification.notification_date = @notification.get_date

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for current_user is too high. [5/3]
Open

  def current_user
    if ( !@current_user.nil? )
      @current_user = @current_user
    else
      if ( !(@current_user = Employee.find_by_authorization_token(cookies[:authorization_token])).nil? )
Severity: Minor
Found in app/helpers/sessions_helper.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for index is too high. [5/3]
Open

  def index
    if ( is_employee? )
      @parents = Parent.all
      if params[:search]
        string_to_search = params[:search].strip.upcase!

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Assignment Branch Condition size for add_alumn is too high. [17.72/15]
Open

def add_alumn
  if ( is_principal? )
    @classroom = Classroom.find(params[:id])
    @alumns = @classroom.alumns
    @alumn = Alumn.find_by_registry(params[:registry])

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [12/10]
Open

    def destroy
        if( is_principal? )
            @suspension = Suspension.find(params[:id])
            @alumn = Alumn.find_by_id(@suspension.alumn_id)
            if( @suspension.destroy )

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Perceived complexity for index is too high. [9/7]
Open

  def index
    if ( is_parent? )
      @alumns = @current_user.alumns
    elsif ( is_employee? )
      @alumns = Alumn.all

This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

Example:

def my_method                   # 1
  if cond                       # 1
    case var                    # 2 (0.8 + 4 * 0.2, rounded)
    when 1 then func_one
    when 2 then func_two
    when 3 then func_three
    when 4..10 then func_other
    end
  else                          # 1
    do_something until a && b   # 2
  end                           # ===
end                             # 7 complexity points

Method has too many lines. [12/10]
Open

  def secretary_params
      params.require(:secretary).permit( :employee_cpf,
                                       :admission_date,
                                       :shift,
                                       :name,

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [12/10]
Open

  def update
    if ( is_principal? )
            @shifts = Shift.all
      @secretary = Secretary.find(params[:id])
      if @secretary.update secretary_params

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [12/10]
Open

  def create
    if ( is_principal? )
            @shifts = Shift.all
      @secretary = Secretary.new(secretary_params)
      if (@secretary.save)

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for give_presence_to_alumn is too high. [5/3]
Open

    def give_presence_to_alumn(date , alumn)
        
        school_misses = nil
        if (alumn != nil)
            school_misses = alumn.school_misses.all

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Cyclomatic complexity for index is too high. [5/3]
Open

  def index
    if ( is_principal? )
      @secretaries = Secretary.all
      if params[:search]
        string_to_search = params[:search].strip.upcase!

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Severity
Category
Status
Source
Language