CLOSER-Cohorts/archivist

View on GitHub
app/controllers/users/confirmations_controller.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

  def update
    with_unconfirmed_confirmable do
      if @confirmable.has_no_password?
        @confirmable.attempt_set_password(params[:user])
        if @confirmable.valid? and @confirmable.password_match?
Severity: Minor
Found in app/controllers/users/confirmations_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

Unused method argument - resource. If it's necessary, use _ or _resource as an argument name to indicate that it won't be used. You can also write as after_confirmation_path_for(*) if you want the method to accept any arguments but don't care about them.
Open

  def after_confirmation_path_for(resource_name, resource)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Unused method argument - resource_name. If it's necessary, use _ or _resource_name as an argument name to indicate that it won't be used. You can also write as after_confirmation_path_for(*) if you want the method to accept any arguments but don't care about them.
Open

  def after_confirmation_path_for(resource_name, resource)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

There are no issues that match your filters.

Category
Status