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
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
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
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'
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
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]
- Read upRead up
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|
- Read upRead up
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']
- Read upRead up
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]
- Read upRead up
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?
- Read upRead up
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
- Read upRead up
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?
- Read upRead up
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')
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)
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)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(grading_methods, student, exam, gradable_scope, collection_students = nil)
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
- Read upRead up
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]
- Read upRead up
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
- Read upRead up
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?
- Read upRead up
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"