bikeindex/bike_index

View on GitHub
app/controllers/admin/users_controller.rb

Summary

Maintainability
A
2 hrs
Test Coverage
F
43%

Method update has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring.
Open

  def update
    if params[:force_merge_email].present?
      force_merge_users(params[:force_merge_email])
    else
      @user.name = params[:user][:name]
Severity: Minor
Found in app/controllers/admin/users_controller.rb - About 1 hr 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 force_merge_users has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
Open

  def force_merge_users(email)
    email = EmailNormalizer.normalize(email)
    secondary_user = User.fuzzy_confirmed_or_unconfirmed_email_find(email)
    if secondary_user.present?
      if secondary_user.unconfirmed?
Severity: Minor
Found in app/controllers/admin/users_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 matching_users has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
Open

  def matching_users
    @search_ambassadors = InputNormalizer.boolean(params[:search_ambassadors])
    @search_banned = InputNormalizer.boolean(params[:search_banned])
    @search_superusers = InputNormalizer.boolean(params[:search_superusers])
    @search_deleted = InputNormalizer.boolean(params[:search_deleted])
Severity: Minor
Found in app/controllers/admin/users_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

There are no issues that match your filters.

Category
Status