fga-gpp-mds/2017.1-Escola-X

View on GitHub

Showing 18 of 3,213 total issues

File escolaX.rb has 689 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'selenium-webdriver'

driver = Selenium::WebDriver.for :chrome

@selenium
Severity: Major
Found in features/step_definitions/escolaX.rb - About 1 day to fix

    File file-input.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * bootstrap-filestyle
     * doc: http://markusslima.github.io/bootstrap-filestyle/
     * github: https://github.com/markusslima/bootstrap-filestyle
     *
    Severity: Minor
    Found in app/assets/javascripts/file-input.js - About 3 hrs to fix

      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 create has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        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])
        Severity: Minor
        Found in app/controllers/sessions_controller.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def index
            if ( is_principal? )
              @secretaries = Secretary.all
              if params[:search]
                string_to_search = params[:search].strip.upcase!
        Severity: Minor
        Found in app/controllers/secretaries_controller.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        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])
        Severity: Minor
        Found in app/controllers/classrooms_controller.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method index has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def index
            if ( is_employee? )
              @parents = Parent.all
              if params[:search]
                string_to_search = params[:search].strip.upcase!
        Severity: Minor
        Found in app/controllers/parents_controller.rb - About 1 hr to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method create has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        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])
        Severity: Minor
        Found in app/controllers/sessions_controller.rb - About 1 hr to fix

          Method index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            def index
              if ( is_parent? )
                @alumns = @current_user.alumns
              elsif ( is_employee? )
                @alumns = Alumn.all
          Severity: Minor
          Found in app/controllers/alumns_controller.rb - About 1 hr to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              if ( is_employee? )
                @strike = @@alumn.strikes.create(strike_params)
                @strike.employee_id = @current_user.id
                if (@strike.save)
          Severity: Minor
          Found in app/controllers/strikes_controller.rb - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method add_alumn has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def add_alumn
            if ( is_principal? )
              @classroom = Classroom.find(params[:id])
              @alumns = @classroom.alumns
              @alumn = Alumn.find_by_registry(params[:registry])
          Severity: Minor
          Found in app/controllers/classrooms_controller.rb - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
                if ( is_principal? )
                      @classroom_grades = ClassroomGrade.all
                      @subject = Subject.new(subject_params)
                      @teacher = Teacher.find_by_registry(params[:teacher_registry])
          Severity: Minor
          Found in app/controllers/subjects_controller.rb - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def create
                  if( is_principal? )
                      @suspension = @@alumn.suspensions.create(suspension_params)
                      @suspension.employee_id = @current_user.id
                      if( @suspension.save )
          Severity: Minor
          Found in app/controllers/suspensions_controller.rb - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method update has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
                if ( is_principal? )
                      @classroom_grades = ClassroomGrade.all
                      @subject = Subject.find(params[:id])
                      @teacher = Teacher.find_by_registry(params[:teacher_registry])
          Severity: Minor
          Found in app/controllers/subjects_controller.rb - About 55 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def destroy
              if ( is_employee? )
                @strike = Strike.find(params[:id])
                @alumn = Alumn.find_by_id(@strike.alumn_id)
                if @strike.destroy
          Severity: Minor
          Found in app/controllers/strikes_controller.rb - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method add_classroom has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          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?)
          Severity: Minor
          Found in app/controllers/subjects_controller.rb - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method give_presence_to_alumn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def give_presence_to_alumn(date , alumn)
                  
                  school_misses = nil
                  if (alumn != nil)
                      school_misses = alumn.school_misses.all
          Severity: Minor
          Found in app/controllers/reader_controller.rb - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def destroy
                  if( is_principal? )
                      @suspension = Suspension.find(params[:id])
                      @alumn = Alumn.find_by_id(@suspension.alumn_id)
                      if( @suspension.destroy )
          Severity: Minor
          Found in app/controllers/suspensions_controller.rb - About 35 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Severity
          Category
          Status
          Source
          Language