Showing 1,214 of 1,261 total issues
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 switch_mcq_mrq_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def switch_mcq_mrq_type(is_mcq, unsubmit)
grading_scheme = is_mcq ? :any_correct : :all_correct
result = @multiple_response_question.update(grading_scheme: grading_scheme)
if result
- 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_token_from_bearer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_token_from_bearer
authorization_header_elements = request.headers['Authorization']&.split
# render json: REQUIRES_AUTHENTICATION, status: :unauthorized and return unless authorization_header_elements
return nil unless authorization_header_elements
- 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
tests = @test_params[:test_cases]
tests[test_type]&.each&.with_index(1) do |test, index|
# String types should be displayed with quotes, other types will be converted to string
# with the str method.
- 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
Function AssessmentConditionForm
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const AssessmentConditionForm = (
props: AnyConditionProps<AssessmentConditionData> & {
assessments: AvailableAssessments;
},
): JSX.Element => {
- 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_success_response
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_success_response(submission)
is_course_koditsu_enabled = current_course.component_enabled?(Course::KoditsuPlatformComponent)
if is_course_koditsu_enabled && @assessment.is_koditsu_enabled
submission.create_new_answers
- 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
Function useDynamicNest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const useDynamicNest = (): UseDynamicNestHook => {
const matches = useMatches();
const location = useLocation();
const [state, setState] = useState<CrumbState>({});
- 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 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 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 view
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def view(data)
session_id, limit = data['session_id'], data['limit'] || DEFAULT_VIEW_HEARTBEATS_LIMIT
return unless (session = @monitor.sessions.find(session_id))
recent_heartbeats = (limit == -1 ? session.heartbeats : session.heartbeats.last(limit)).map do |heartbeat|
- 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"
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
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 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 poll_codaveri_evaluation_results
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def poll_codaveri_evaluation_results(response_status, response_body, evaluation_id)
poll_count = 0
until ![201, 202].include?(response_status) || poll_count >= MAX_POLL_RETRIES
sleep(POLL_INTERVAL_SECONDS)
response_status, response_body = fetch_codaveri_evaluation(evaluation_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 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"