Showing 1,205 of 1,252 total issues
Method validate_codaveri_question
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_codaveri_question
return if (!is_codaveri && !live_feedback_enabled) || duplicating?
# TODO: Move this validation logic to frontend, to prevent user from submitting in the first place.
if !CodaveriAsyncApiService.language_valid_for_codaveri?(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 fetch_all_ancestor_assessments
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fetch_all_ancestor_assessments
current_assessment = Course::Assessment.preload(:duplication_traceable).find(assessment_params[:id])
@ancestors = [current_assessment]
while current_assessment.duplication_traceable.present? &&
current_assessment.duplication_traceable.source_id.present?
- 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 exception
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def exception
return nil unless error?
exception_class = time_limit_exceeded? ? TimeLimitExceededError : Error
exception_class.new(exception_class.name, stdout, stderr)
- 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 submission_files=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def submission_files=(files)
ensure_file_open!
remove_folder_files(SUBMISSION_PATH)
files.each do |path, file|
- 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 get_output
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_output(test_case_result)
if test_case_result
output = test_case_result.messages['output']
output = test_case_result.messages['failure'] if output.blank?
# For codaveri programming test output, the stderror for each test case
- 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 highlight_code_block
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def highlight_code_block(code, language = nil)
return if code_size_exceeds_limit?(code)
code = html_escape(code) unless code.html_safe?
code = code.gsub(/\r\n|\r/, "\n").html_safe
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
if @settings.update(settings_components_params) && current_course.save
is_koditsu_enabled = settings_components_params['enabled_component_ids'].
include?('course_koditsu_platform_component')
- 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_course
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def duplicate_course(source_course, destination_instance_id)
duplicated_course = Course.transaction do
begin
new_course = duplicator.duplicate(source_course)
new_course.instance_id = destination_instance_id if destination_instance_id
- 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 pending_assessment_submissions_count
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def pending_assessment_submissions_count
self.class.include Course::Assessment::SubmissionsHelper
if current_course_user&.manager_or_owner?
(my_students_pending_submissions_count > 0) ? my_students_pending_submissions_count : pending_submissions_count
- 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 deduce_tenant_host
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def deduce_tenant_host
if Rails.env.development?
default_app_host = Application::Application.config.x.default_app_host
if request.host.downcase.ends_with?(default_app_host)
- 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 top_level_split
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def top_level_split(text, delimiter)
opening = '([{'
closing = ')]}'
balance = 0
idx = 0
- 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 zip_test_files
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def zip_test_files(test_type, zip) # rubocop:disable Metrics/AbcSize
# Print test class preamble
test_class_name = "#{test_type}_tests_grader".camelize
class_definition = <<~PYTHON
class #{test_class_name}(unittest.TestCase):
- 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 explanations_for_incorrect_point_missing_keywords
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def explanations_for_incorrect_point_missing_keywords(answer_text_lemma_status, point)
empty_information = I18n.t('course.assessment.answer.text_response_comprehension_auto_grading.explanations.empty_information')
missing_keywords = point.
solutions.
select(&:compre_keyword?).
- 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 authenticate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def authenticate(password)
return true unless @assessment.session_password_protected?
if password == @assessment.session_password
create_new_token if @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 destroy
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def destroy
@alternative_timeline_id = destroy_params[:revert_to]
revert_course_users_to_alternative_timeline if @alternative_timeline_id.present?
ActiveRecord::Base.transaction do
- 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 admin_sidebar_items
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def admin_sidebar_items
can_manage_users = can?(:manage_users, current_course)
can_manage_personal_times =
current_course.show_personalized_timeline_features? && can?(:manage_personal_times, current_course)
- 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 closing_reminder
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def closing_reminder(survey, token)
email_enabled = survey.course.email_enabled(:surveys, :closing_reminder)
return unless survey.closing_reminder_token == token && survey.published?
return unless email_enabled.phantom || email_enabled.regular
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def uncompleted_subscribed_students(survey, include_phantom, include_unsubscribed)
course_users = survey.course.course_users.student
email_enabled = survey.course.email_enabled(:surveys, :closing_reminder)
# Eager load :user as it's needed for the recipient email.
students = if (email_enabled.regular && !email_enabled.phantom) || !include_phantom
- 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 afterDraw
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
afterDraw(chart) {
if (
chart.data.datasets.length === 0 ||
chart.data.datasets.every((d) => d.data.length === 0)
) {
- 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_koditsu_invitation_job
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_koditsu_invitation_job
is_course_koditsu_enabled = current_course.component_enabled?(Course::KoditsuPlatformComponent)
is_assessment_koditsu_enabled = @assessment.koditsu_assessment_id && @assessment.is_koditsu_enabled
return unless is_course_koditsu_enabled && is_assessment_koditsu_enabled
- 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"