TeaWithStrangers/tws-on-rails

View on GitHub

Showing 30 of 35 total issues

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

  def self.find_new_status(user)
    tea_times = user.tea_times.completed.order('start_time asc').to_a
    most_recent = tea_times.last
    user.send_drip_email(most_recent)
    commitment = user.commitment
Severity: Minor
Found in app/jobs/refresh_host_activity_status.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 jfdi_signup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def jfdi_signup
    # Querystring params (all optional):
    # - redirect_to_tt: integer - Set the tea time to redirect to after signup
    # - city_id: integer - Set the default selected city in home city dropdown
    # - remind_next_month: (any) - Pass a querystring param to the registration
Severity: Minor
Found in app/controllers/static_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 commitment_overview= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def commitment_overview=(overview)
    if overview.to_s != HostDetail::REGULAR_COMMITMENT.to_s
      if commitment.nil?
        if overview.to_s == HostDetail::NO_COMMITMENT.to_s
          HostMailer.commitment_intro(id).deliver_later
Severity: Minor
Found in app/models/user.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 transform_tea_times has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def transform_tea_times(tea_times)
    # For each available city, create a hash entry and an empty list
    # of tea times
    tea_times_by_city = Hash.new

Severity: Minor
Found in app/controllers/tea_times_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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    if params[:approval_action]
      approver = CityApprover.new(@city.id)
      case params[:approval_action]
      when "merge"
Severity: Minor
Found in app/controllers/cities_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

Function getInterests has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

var getInterests = function() {
  $.get('/api/v1/users/self/interests', function(user_info) {
    if (!user_info) { return; }

    if (user_info.leading) {
Severity: Minor
Found in app/assets/javascripts/cities.js - 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 delete_user_by_email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.delete_user_by_email(email)
    if @sg
      user_response = @sg.client.contactdb.recipients.search.get(query_params: {email: email})
      if user_response.status_code == "200"
        resp = JSON.parse(user_response.body)
Severity: Minor
Found in app/services/send_grid_list.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 inactive_host_posted has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def inactive_host_posted(host_id)
    @host = User.find_by_id(host_id)
    cancel_delivery unless @host
    cancel_delivery unless @host.commitment_overview == HostDetail::INACTIVE_COMMITMENT
    cancel_delivery unless @host.tea_times.future.pending.any?
Severity: Minor
Found in app/mailers/host_mailer.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 custom_first_reminder has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def custom_first_reminder(attendance_id)
    sendgrid_category "Tea Time Reminder"

    @attendance = Attendance.find(attendance_id)
    cancel_delivery unless @attendance
Severity: Minor
Found in app/mailers/attendance_mailer.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 flake! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def flake!(opts = {})
    unless flake?
      if !tea_time.spots_remaining?
        tea_time.send_waitlist_notifications
      end
Severity: Minor
Found in app/models/attendance.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