Coursemology/coursemology2

View on GitHub
app/controllers/concerns/course/lesson_plan/strategies/fomo_personalization_strategy.rb

Summary

Maintainability
A
0 mins
Test Coverage

Method execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Wontfix

  def execute(course_user, precomputed_data, items_to_shift = nil) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
    return if precomputed_data[:learning_rate_ema].nil?

    @course_tz = course_user.course.time_zone
    reference_point = personal_point = precomputed_data[:items].first.reference_time_for(course_user).start_at

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_points has 5 arguments (exceeds 4 allowed). Consider refactoring.
Wontfix

  def update_points(course_user, item, submitted_items, reference_point, personal_point)

Method shift_start_at has 5 arguments (exceeds 4 allowed). Consider refactoring.
Wontfix

  def shift_start_at(personal_time, reference_time, personal_point, reference_point, learning_rate_ema)

There are no issues that match your filters.

Category
Status