Showing 1,205 of 1,252 total issues
Method perform_tracked
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def perform_tracked(assessment, question, answer)
ActsAsTenant.without_tenant do
feedback_config = Course::Assessment::Answer::ProgrammingCodaveriAsyncFeedbackService.default_config.merge(
revealLevel: 'solution',
language: Course::Assessment::Answer::ProgrammingCodaveriAsyncFeedbackService.language_from_locale(
- Read upRead up
- Create a ticketCreate a ticket
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 complete_todo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def complete_todo
return unless todo
todo.update_attribute(:workflow_state, 'completed') unless todo.completed?
rescue ActiveRecord::ActiveRecordError => e
- Read upRead up
- Create a ticketCreate a ticket
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 restart_todo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def restart_todo
return if video.destroying? || todo.nil?
todo.update_attribute(:workflow_state, 'not_started') unless todo.not_started?
rescue ActiveRecord::ActiveRecordError => e
- Read upRead up
- Create a ticketCreate a ticket
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 send_submit_notification
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_submit_notification
return unless workflow_state_before_last_save == 'attempting'
# When a course staff submits/force submits a submission on behalf of the student,
# the updater of the submission is set as the course staff, which is different from the creator (the student).
# Even though a submission is force created by a course staff, the creator is still set
- Read upRead up
- Create a ticketCreate a ticket
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 ScribingQuestionForm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const ScribingQuestionForm = (props) => {
const { data, initialValues, scribingId } = props;
const { t } = useTranslation();
- Read upRead up
- Create a ticketCreate a ticket
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 render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
submissionState,
showPrivate,
showEvaluation,
- Read upRead up
- Create a ticketCreate a ticket
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 restart_todo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def restart_todo
return if assessment.destroying? || todo.nil?
todo.update_attribute(:workflow_state, 'not_started') unless todo.not_started?
rescue ActiveRecord::ActiveRecordError => e
- Read upRead up
- Create a ticketCreate a ticket
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 define_permissions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def define_permissions
if course_user
allow_students_show_announcements if course_user.student?
allow_staff_read_announcements if course_user.staff?
allow_teaching_staff_manage_announcements if course_user.teaching_staff?
- Read upRead up
- Create a ticketCreate a ticket
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 safely_mark_as_read!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def safely_mark_as_read!(options)
unless respond_to?(:mark_as_read!) || Rails.env.production?
raise "Did you have #{self.class.name} `acts_as_readable`?"
end
- Read upRead up
- Create a ticketCreate a ticket
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 ProgrammingFiles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const ProgrammingFiles = ({
readOnly,
questionId,
answerId,
language,
- Read upRead up
- Create a ticketCreate a ticket
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 define_permissions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def define_permissions
if course_user
define_all_video_permissions
define_staff_video_permissions if course_user.staff?
define_teaching_staff_video_permissions if course_user.teaching_staff?
- Read upRead up
- Create a ticketCreate a ticket
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 restart_todo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def restart_todo
return if survey.destroying? || todo.nil?
todo.update_attribute(:workflow_state, 'not_started') unless todo.not_started?
rescue ActiveRecord::ActiveRecordError => e
- Read upRead up
- Create a ticketCreate a ticket
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 @topic.posts.count == 1 && @topic.destroy
render json: { isTopicDeleted: true }
elsif @post.destroy
@topic.update_column(:latest_post_at, @topic.posts.last&.created_at || @topic.created_at)
- Read upRead up
- Create a ticketCreate a ticket
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_submission
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_submission
current_course_user = current_course.course_users.find_by(user: current_user)
@assessment = @folder.owner
existing_submission = @assessment.submissions.find_by(creator: current_user)
unless existing_submission
- Read upRead up
- Create a ticketCreate a ticket
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 extract_autograded_meta
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def extract_autograded_meta(attachment)
attachment.open(binmode: true) do |temporary_file|
package = Course::Assessment::ProgrammingPackage.new(temporary_file)
meta = package.meta_file
@old_meta = meta.present? ? JSON.parse(meta) : nil
- Read upRead up
- Create a ticketCreate a ticket
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_defaults
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_defaults
self.start_at ||= Time.zone.now.beginning_of_hour
self.end_at ||= self.start_at + 1.month
self.default_reference_timeline ||= reference_timelines.new(default: true)
self.default_timeline_algorithm ||= 0 # 'fixed' algorithm
- Read upRead up
- Create a ticketCreate a ticket
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 extract_autograded_meta
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def extract_autograded_meta(attachment)
attachment.open(binmode: true) do |temporary_file|
package = Course::Assessment::ProgrammingPackage.new(temporary_file)
meta = package.meta_file
@old_meta = meta.present? ? JSON.parse(meta) : nil
- Read upRead up
- Create a ticketCreate a ticket
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 duplicate_objects
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def duplicate_objects(objects)
# TODO: Email the user when the duplication is complete.
Course.transaction do
duplicated = duplicator.duplicate(objects)
before_save(objects, duplicated)
- Read upRead up
- Create a ticketCreate a ticket
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 uncompleted_subscribed_students
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def uncompleted_subscribed_students(assessment, course_user_ids, include_unsubscribed)
course_users = assessment.course.course_users
course_users = course_users.where(id: course_user_ids) unless course_user_ids.empty?
email_enabled = assessment.course.email_enabled(:assessments, :closing_reminder, assessment.tab.category.id)
# Eager load :user as it's needed for the recipient email.
- Read upRead up
- Create a ticketCreate a ticket
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 copy_archive
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def copy_archive(zip_file, tar_file, prefix = nil)
zip_file.each do |entry|
next unless entry.file?
zip_entry_stream = entry.get_input_stream
- Read upRead up
- Create a ticketCreate a ticket
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"