maestrano/mno-enterprise

View on GitHub
core/lib/mno_enterprise/concerns/controllers/auth/confirmations_controller.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method finalize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def finalize
    @confirmation_token = params[:user].delete(:confirmation_token)
    self.resource = resource_class.find_for_confirmation(@confirmation_token)

    # Exit action and redirect if user is already confirmed

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 show has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    @confirmation_token = params[:confirmation_token]
    self.resource = resource_class.find_for_confirmation(@confirmation_token)

    # Exit if no resources

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 after_confirmation_path_for has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def after_confirmation_path_for(resource_name, resource, opts = {})
      return new_user_session_path unless resource

      # 3 days is the duration of an invite.
      if resource.created_at > 3.days.ago

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 7 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    self.resource = @resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)

    # Redirect straight away if no changes
    if @resource.email == params[:user][:email]

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