Showing 122 of 226 total issues
Method update_coach_enrollments
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_coach_enrollments
course =
authorize(
scope.find(params[:course_id]),
policy_class: Schools::CoursePolicy
Method execute
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(assignment_params)
Assignment.transaction do
@assignment.role = assignment_params[:role]
@assignment.completion_instructions =
assignment_params[:completion_instructions]
Method target_rows
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def target_rows
values =
targets.map do |target|
milestone = milestone?(target)
Method target_rows
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def target_rows
values =
team_targets.map do |target|
milestone = milestone?(target)
Method create_quiz
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_quiz(assignments)
assignments.each do |old_assignment, new_assignment|
next unless old_assignment.quiz?
# create quiz
- 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 grade
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def grade
TimelineEvent.transaction do
if passed?
evaluation_criteria.each do |criterion|
TimelineEventGrade.create!(
- 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 execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def execute
raise "user is a school admin" if @user.school_admin.present?
if @user.discord_user_id.present?
Discord::ClearRolesService.new(
- 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 execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def execute(period_from, period_to)
students = @course.students.active.where(excluded_from_leaderboard: false)
log("Recording leaderboard entries for #{students.count} students in Course##{@course.id}...")
LeaderboardEntry.transaction do
- 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 execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def execute
debug_value = {}
cache_new_and_popular_topics
cache_older_topics_with_recent_activity
- 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 courses
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def courses
if current_user.blank?
current_school
.courses
.live
- 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
Avoid deeply nested control flow statements. Open
for (a = n.args || [], i = 0; i < a.length; ++i)
if ("function" == typeof (l = a[i])) {
l(e);
break;
}
Method authorized?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def authorized?
return false if current_user.blank?
# Has access to school
return false unless course&.school == current_school && student.present?
- 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 course_link
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def course_link(course)
return if course.nil?
default_path = view.curriculum_course_path(course)
- 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 checklist_data_should_not_be_mutated
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def checklist_data_should_not_be_mutated
old_checklist =
@submission.checklist.map do |c|
[
c["title"],
- 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 query_authorized?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def query_authorized?
return false if current_user.blank?
# Has access to school
return false unless course&.school == current_school && student.present?
- 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 active?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def active?(key, user = nil)
return true if overridden?
feature = find_by(key: key)
- 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 create_vimeo_video
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_vimeo_video
vimeo_api = Vimeo::ApiService.new(current_school)
video_title = title.presence || target.title
response = vimeo_api.create_video(size, video_title, description)
- 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
Function audioRecorder
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function audioRecorder(authenticity_token, attachingCB) {
const [state, setState] = useState({
recording: false,
url: undefined,
blob: undefined,
- 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 applicable_submissions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def applicable_submissions
stage_1 = course.timeline_events.not_auto_verified.live
# Filter by target
stage_2 =
- 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 stringify_ids
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def stringify_ids(hash)
hash.keys.each_with_object({}) do |key, result|
string_key = key.to_s
original_value = hash[key]
- 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"