lighthouse-labs/laser_shark

View on GitHub

Showing 27 of 46 total issues

Method commit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def commit
    return nil unless client
    if @activity.revisions_gistid?
      update
    else
Severity: Minor
Found in lib/github/activity_revision.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 day has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def day
    return @day if @day
    d = params[:number] || params[:day_number]
    @day = case d
    when 'today'
Severity: Minor
Found in app/controllers/concerns/course_calendar.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 sortable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def sortable(column, title = nil)
      title ||= column.titleize
      css_class = column == params[:sort] ? "current #{params[:direction]}" : nil
      direction = (column == params[:sort] && params[:direction] == "asc") ? "desc" : "asc"
      link_to title, {
Severity: Minor
Found in app/helpers/feedbacks_helper.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    if !@user.completed_registration && @user.update(profile_params)
      @user.update(completed_registration: true)
      if session[:invitation_code]
        apply_invitation_code(session[:invitation_code])
Severity: Minor
Found in app/controllers/profiles_controller.rb - About 25 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 teachers_on_duty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def teachers_on_duty
    return [] if current_user && !current_user.is_a?(Teacher) && !current_user.is_a?(Student)

    if current_user
      location = current_user.location
Severity: Minor
Found in app/controllers/application_controller.rb - About 25 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 to_s has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def to_s
    return "setup" if @date == "setup"
    return @to_s if @to_s
    days = (@date.to_date - @cohort.start_date).to_i

Severity: Minor
Found in app/models/curriculum_day.rb - About 25 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 cohort has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def cohort
    # Teachers can switch to any cohort
    if teacher?
      @cohort ||= Cohort.find_by(id: session[:cohort_id]) if session[:cohort_id]
    end
Severity: Minor
Found in app/controllers/application_controller.rb - About 25 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