GAKUEngine/gaku

View on GitHub
core/app/controllers/gaku/courses/exams_controller.rb

Summary

Maintainability
C
1 day
Test Coverage

Method grading has 151 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def grading
      def init_variables
        @course = Course.find(params[:course_id])
        @exam = Exam.find(params[:id])
        @students = @course.students
Severity: Major
Found in core/app/controllers/gaku/courses/exams_controller.rb - About 6 hrs to fix

    Method method_ratio has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

            def method_ratio
              default_grade_level_deviation = [100, 66, 62, 58, 55, 50, 45, 37, 0]
              @rank_level = [15, 20]
    
              # default_grade_level_percent = [5, 5, 10, 10, 30, 10, 100]
    Severity: Minor
    Found in core/app/controllers/gaku/courses/exams_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 set_student_exams_total_scores_and_set_exams_average has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def set_student_exams_total_scores_and_set_exams_average
            @exams.each do |exam|
              @students.each do |student|
                # 素点用と得点用変数の初期化 --------
                @student_exams_total_score[:raw][exam.id][student.id] = 0.0
    Severity: Minor
    Found in core/app/controllers/gaku/courses/exams_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

    There are no issues that match your filters.

    Category
    Status