Coursemology/coursemology2

View on GitHub

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(
Severity: Minor
Found in app/jobs/course/assessment/answer/programming_codaveri_feedback_job.rb - About 35 mins to fix

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
Severity: Minor
Found in app/models/concerns/course/video/submission/todo_concern.rb - About 35 mins to fix

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
Severity: Minor
Found in app/models/concerns/course/video/submission/todo_concern.rb - About 35 mins to fix

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
Severity: Minor
Found in app/models/concerns/course/assessment/submission/notification_concern.rb - About 35 mins to fix

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();

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,

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
Severity: Minor
Found in app/models/concerns/course/assessment/submission/todo_concern.rb - About 35 mins to fix

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?
Severity: Minor
Found in app/models/components/course/announcements_ability_component.rb - About 35 mins to fix

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

Severity: Minor
Found in app/models/concerns/safe_mark_as_read_concern.rb - About 35 mins to fix

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,

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?
Severity: Minor
Found in app/models/components/course/videos_ability_component.rb - About 35 mins to fix

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
Severity: Minor
Found in app/models/concerns/course/survey/response/todo_concern.rb - About 35 mins to fix

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)
Severity: Minor
Found in app/controllers/course/forum/posts_controller.rb - About 35 mins to fix

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
Severity: Minor
Found in app/controllers/course/material/materials_controller.rb - About 35 mins to fix

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

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
Severity: Minor
Found in app/models/course.rb - About 35 mins to fix

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

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)
Severity: Minor
Found in app/services/course/duplication/object_duplication_service.rb - About 35 mins to fix

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.
Severity: Minor
Found in app/services/course/assessment/reminder_service.rb - About 35 mins to fix

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
Severity: Minor
Found in lib/autoload/coursemology_docker_container.rb - About 35 mins to fix

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

Severity
Category
Status
Source
Language