scottwillson/racing_on_rails

View on GitHub
app/controllers/people_controller.rb

Summary

Maintainability
C
1 day
Test Coverage

Method create_login has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

  def create_login
    @return_to = params[:return_to]

    if params[:id].present?
      @person = Person.find_using_perishable_token(params[:id])
Severity: Minor
Found in app/controllers/people_controller.rb - About 5 hrs 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 create_login has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_login
    @return_to = params[:return_to]

    if params[:id].present?
      @person = Person.find_using_perishable_token(params[:id])
Severity: Major
Found in app/controllers/people_controller.rb - About 3 hrs to fix

    Method person_params has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def person_params
        params.require(:person).permit(
          :billing_city,
          :billing_country_code,
          :billing_first_name,
    Severity: Major
    Found in app/controllers/people_controller.rb - About 2 hrs to fix

      Avoid too many return statements within this method.
      Open

          return render(:new_login) if @person.errors.any?
      Severity: Major
      Found in app/controllers/people_controller.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return render(:new_login)
        Severity: Major
        Found in app/controllers/people_controller.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return render(:new_login)
          Severity: Major
          Found in app/controllers/people_controller.rb - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status