fga-gpp-mds/2017.1-Escola-X

View on GitHub

Showing 3,213 of 3,213 total issues

Perceived complexity for create is too high. [16/7]
Open

  def create
    if ( !Alumn.find_by_registry(params[:login]).nil? )
      @user = Alumn.find_by_registry(params[:login])
    elsif ( !Parent.find_by_login(params[:login]).nil? )
      @user = Parent.find_by_login(params[:login])

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

Cyclomatic complexity for create is too high. [12/3]
Open

  def create
    if ( !Alumn.find_by_registry(params[:login]).nil? )
      @user = Alumn.find_by_registry(params[:login])
    elsif ( !Parent.find_by_login(params[:login]).nil? )
      @user = Parent.find_by_login(params[:login])

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 index is too high. [24.37/15]
Open

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

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 add_classroom is too high. [24.23/15]
Open

  def add_classroom
    if ( is_principal? )
      @classroom = Classroom.find(params[:id])
      @subject = Subject.find(params[:subject_id])
            if !((ClassroomSubject.where(classroom_id: @classroom.id).where(subject_id: @subject.id)).exists?)

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. [19/10]
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 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. [19/10]
Open

  def create
      if ( is_principal? )
            @classroom_grades = ClassroomGrade.all
            @subject = Subject.new(subject_params)
            @teacher = Teacher.find_by_registry(params[:teacher_registry])

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. [18/10]
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 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. [18/10]
Open

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

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. [17/10]
Open

  def create
    if ( is_employee? )
      @strike = @@alumn.strikes.create(strike_params)
      @strike.employee_id = @current_user.id
      if (@strike.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.

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

    def create
        if( is_principal? )
            @suspension = @@alumn.suspensions.create(suspension_params)
            @suspension.employee_id = @current_user.id
            if( @suspension.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.

Assignment Branch Condition size for index is too high. [21.47/15]
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 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. [16/10]
Open

  def add_classroom
    if ( is_principal? )
      @classroom = Classroom.find(params[:id])
      @subject = Subject.find(params[:subject_id])
            if !((ClassroomSubject.where(classroom_id: @classroom.id).where(subject_id: @subject.id)).exists?)

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.

Assignment Branch Condition size for mountCurrentDate is too high. [20.98/15]
Open

    def mountCurrentDate() 
    
         #hour = (Time.current.hour - ADJUSTING_FUSE_TO_BRAZILIAN).to_s
         #minute = Time.current.min .to_s
         day = Time.current.day.to_s
Severity: Minor
Found in app/helpers/reader_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. [15/10]
Open

  def create
    if ( is_principal? )
      @shifts = Shift.all
      @alumn = Alumn.new(alumn_params)
      @alumn.parent_id = @@parent.id

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.

Assignment Branch Condition size for mountCurrentDate is too high. [20.98/15]
Open

    def mountCurrentDate() 
    
         #hour = (Time.current.hour - ADJUSTING_FUSE_TO_BRAZILIAN).to_s
         #minute = Time.current.min .to_s
         day = Time.current.day.to_s

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 post_grades is too high. [20.49/15]
Open

  def post_grades
    if is_secretary?
      @classroom = Classroom.find(params[:id])
      @subject = Subject.find(params[:subject_id])
      @alumn = Alumn.find(params[:alumn_id])

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

Function constructor has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        constructor : function() {
            var _self = this,
                html = '',
                id = _self.$element.attr('id'),
                files = [],
Severity: Major
Found in app/assets/javascripts/file-input.js - About 2 hrs to fix

    Method has too many lines. [14/10]
    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 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. [14/10]
    Open

      def update
        if ( is_principal? )
          @shifts = Shift.all
          @alumn = Alumn.find(params[:id])
          @classrooms = Classroom.all.order('name_classroom')

    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. [14/10]
    Open

      def alumn_params
        params.require(:alumn).permit(:registry,
                                      :shift,
                                      :name,
                                      :address,

    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.

    Severity
    Category
    Status
    Source
    Language