Coursemology/coursemology2

View on GitHub

Showing 1,205 of 1,252 total issues

Method define_permissions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def define_permissions
    if user
      allow_instructors_create_courses
      allow_unregistered_users_registering_courses
    end
Severity: Minor
Found in app/models/components/course/course_ability_component.rb - About 45 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 push has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def push(method)
    return unless pushable?(actable) && course.component_enabled?(Course::StoriesComponent)

    Cikgo::ResourcesService.push_resources!(course, [{ method: method, id: id.to_s }.merge(send("#{method}_payload"))])
  rescue StandardError => e
Severity: Minor
Found in app/models/concerns/course/lesson_plan/item/cikgo_push_concern.rb - About 45 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 CodaveriCommentCard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const CodaveriCommentCard = (props) => {
  const {
    editValue,
    handleChange,
    updateComment,

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

            if (this.rect && this.rect.type === 'rect') {
              this.rect.selectable = false;
            }

Function render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  render() {
    const { assessment, isLoading, submissions } = this.props;
    const {
      includePhantoms,
      tab,

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 email_course has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def email_course(notification)
    email_enabled = notification.course.email_enabled(:announcements, :new_announcement)
    notification.course.course_users.each do |course_user|
      next if course_user.email_unsubscriptions.where(course_settings_email_id: email_enabled.id).exists?

Severity: Minor
Found in app/notifiers/course/announcement_notifier.rb - About 45 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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    result = @programming_question.class.transaction do
      @question_assessment.skill_ids = programming_question_params[:question_assessment].
                                       try(:[], :skill_ids)
      @programming_question.assign_attributes(programming_question_params.
Severity: Minor
Found in app/controllers/course/assessment/question/programming_controller.rb - About 45 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 not_late_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def not_late_hash(submissions)
    current_time = Time.now

    submissions.map do |s|
      personal_end_at = @personal_end_at_hash[[s['assessment_id'], s['course_user_id']]]
Severity: Minor
Found in app/controllers/concerns/course/statistics/counts_concern.rb - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
Open

  def destroy
    koditsu_question_id = @programming_question.acting_as.koditsu_question_id

    success = @programming_question.class.transaction do
      raise ActiveRecord::Rollback unless @programming_question.destroy
Severity: Minor
Found in app/controllers/course/assessment/question/programming_controller.rb - About 45 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 duplicate_from has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def duplicate_from(other_uploader)
    case other_uploader.send(:storage).class.name
    when 'CarrierWave::Storage::File'
      begin
        cache!(File.new(other_uploader.file.path))
Severity: Minor
Found in app/uploaders/image_uploader.rb - About 45 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 load_resource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def load_resource
    course_users = current_course.course_users
    case params[:action]
    when 'index'
      if params[:as_basic_data] == 'true'
Severity: Minor
Found in app/controllers/course/users_controller.rb - About 45 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 explanations_for_correct_paraphrase has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def explanations_for_correct_paraphrase(answer_text_array, keyword_status, hash_point_serial)
    hash_keywords = {} # point_id => [word in answer_text, information]
    keyword_status.each_with_index do |s, index|
      unless s.nil?
        hash_keywords[s.point.id] = [] unless hash_keywords.key?(s.point.id)

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 8 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    @assessment.update_mode(autograded_params)

    # Randomized Assessment is temporarily hidden (PR#5406)
    # @assessment.update_randomization(randomization_params)
Severity: Minor
Found in app/controllers/course/assessment/assessments_controller.rb - About 45 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 closing_reminder_staff has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def closing_reminder_staff(assessment, students)
    course_instructors = assessment.course.instructors.includes(:user)
    student_list = name_list(students)
    email_enabled = assessment.course.email_enabled(:assessments, :closing_reminder_summary, assessment.tab.category.id)
    course_instructors.each do |instructor|
Severity: Minor
Found in app/services/course/assessment/reminder_service.rb - About 45 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 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    # Randomized Assessment is temporarily hidden (PR#5406)
    # @assessment.update_randomization(randomization_params)

    is_course_koditsu_enabled = current_course.component_enabled?(Course::KoditsuPlatformComponent)
Severity: Minor
Found in app/controllers/course/assessment/assessments_controller.rb - About 45 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 closing_reminder_staff has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def closing_reminder_staff(survey, students)
    course_instructors = survey.course.instructors.includes(:user)
    student_list = name_list(students)
    email_enabled = survey.course.email_enabled(:surveys, :closing_reminder_summary)
    course_instructors.each do |instructor|
Severity: Minor
Found in app/services/course/survey/reminder_service.rb - About 45 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 accept_all_pending_invitations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def accept_all_pending_invitations
    return unless confirmed?

    all_unconfirmed_invitations = Course::UserInvitation.where(email: email).unconfirmed

Severity: Minor
Found in app/models/user/email.rb - About 45 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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def initialize(language, memory_limit, time_limit, max_time_limit, package, timeout)
Severity: Minor
Found in app/services/course/assessment/programming_evaluation_service.rb - About 45 mins to fix

Method execute has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def execute(language, memory_limit, time_limit, max_time_limit, package, timeout = nil)
Severity: Minor
Found in app/services/course/assessment/programming_evaluation_service.rb - About 45 mins to fix

Function ConditionsManager has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const ConditionsManager = (props: ConditionsManagerProps): JSX.Element => {
  const { t } = useTranslation();
  const [conditions, setConditions] = useState(props.conditionsData.conditions);
  const [conditionToCreate, setConditionToCreate] =
    useState<ConditionAbility>();
Severity: Minor
Found in client/app/lib/components/extensions/conditions/ConditionsManager.tsx - About 45 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