GAKUEngine/gaku

View on GitHub

Showing 20 of 69 total issues

Method change has 547 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def change
    create_table :gaku_badge_types do |t|
      t.string   :name
      t.string   :code
      t.text     :description
Severity: Major
Found in core/db/migrate/20131025073352_gaku_core.rb - About 2 days to fix

    File 20131025073352_gaku_core.rb has 553 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'gaku/migrations'
    
    class GakuCore < ActiveRecord::Migration[4.2]
    
      include Gaku::Migrations
    Severity: Major
    Found in core/db/migrate/20131025073352_gaku_core.rb - About 1 day to fix

      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

        File schema.rb has 411 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        ActiveRecord::Schema.define(version: 20121013102921) do
        
          create_table 'gaku_addresses', force: true do |t|
            t.string   'address1'
            t.string   'address2'
        Severity: Minor
        Found in core/db/schema.rb - About 5 hrs to fix

          Method up has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def up
              create_table :gaku_attendance_types do |t|
                t.string   :name
                t.string   :color_code
                t.boolean  :counted_absent
          Severity: Minor
          Found in core/db/migrate/20131014065028_translations.rb - About 1 hr 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 find_state has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

              def find_state
                result = nil
                Carmen.i18n_backend.available_locales.each do |locale|
                  Carmen.i18n_backend.locale = locale
                  Carmen::Country.all.each do |country|
            Severity: Minor
            Found in api/app/services/gaku/api/address_create_service.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 lookup has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                  def lookup(locale, key, scope = [], options = {})
                    init_translations unless initialized?
                    keys = I18n.normalize_keys(locale, key, scope, options[:separator])
            
                    puts "I18N keys: #{keys}"  if ENV['I18N_DEBUG']
            Severity: Minor
            Found in core/config/initializers/i18n.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 student_names has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def student_names(options = {})
                  @names_preset ||= Gaku::Preset.names
                  preset = @names_preset
            
                  if options[:without_formating]
            Severity: Minor
            Found in core/app/decorators/gaku/person_decorator.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 setup_assets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def setup_assets
                  @lib_name = 'gaku'
                  %w( javascripts stylesheets images ).each do |path|
                    empty_directory "app/assets/#{path}/gaku/frontend" if defined? Gaku::Frontend || Rails.env.test?
                    empty_directory "app/assets/#{path}/gaku/admin" if defined? Gaku::Admin || Rails.env.test?
            Severity: Minor
            Found in core/lib/generators/gaku/docker/docker_generator.rb - About 45 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 weight_calculate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def weight_calculate
                  if (exam.total_weight_except(self) + weight) > 100
                    last = exam.exam_portions.last
            
                    interval = weight - weight_was
            Severity: Minor
            Found in core/app/models/gaku/exam_portion.rb - About 45 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 setup_assets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def setup_assets
                  @lib_name = 'gaku'
                  %w( javascripts stylesheets images ).each do |path|
                    empty_directory "app/assets/#{path}/gaku/frontend" if defined? Gaku::Frontend || Rails.env.test?
                    empty_directory "app/assets/#{path}/gaku/admin" if defined? Gaku::Admin || Rails.env.test?
            Severity: Minor
            Found in core/lib/generators/gaku/install/install_generator.rb - About 45 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 api_process has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def api_process(action, params = {}, session = nil, flash = nil, method = 'get')
            Severity: Minor
            Found in core/lib/gaku/testing/controller_helpers.rb - About 35 mins to fix

              Method process_js_gaku_action has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def process_js_gaku_action(action, method = 'GET', params = nil, session = nil, flash = nil)
              Severity: Minor
              Found in core/lib/gaku/testing/controller_helpers.rb - About 35 mins to fix

                Method process_gaku_action has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def process_gaku_action(action, method = 'GET', parameters = nil, session = nil, flash = nil)
                Severity: Minor
                Found in core/lib/gaku/testing/controller_helpers.rb - About 35 mins to fix

                  Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          def initialize(grading_methods, student, exam, gradable_scope, collection_students = nil)
                  Severity: Minor
                  Found in core/lib/gaku/grading/single/calculations.rb - About 35 mins to fix

                    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

                    Method set_locale has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def set_locale
                          if current_user && params[:locale]
                            I18n.locale = params[:locale]
                            Carmen.i18n_backend.locale = I18n.locale
                            current_user.settings[:locale] = params[:locale]
                    Severity: Minor
                    Found in core/app/controllers/gaku/core_controller.rb - About 25 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 comma_separated_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def comma_separated_list(objects)
                          if objects.any?
                            objects.map do |object|
                              block_given? ? yield(object) : object
                            end.join(', ').html_safe
                    Severity: Minor
                    Found in core/app/helpers/gaku/gaku_helper.rb - About 25 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 interval_results has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def interval_results
                        @students_by_score = students_by_score
                        student_positions.each_with_object(Hash.new { |h, k| h[k] = [] }) do |(key, value), hash|
                          while value > hash[key].length
                            break if @students_by_score.empty?
                    Severity: Minor
                    Found in core/lib/gaku/grading/collection/interval.rb - About 25 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