Skip to content

Method cops not found when changing the method #46

@alexkuebo

Description

@alexkuebo

We've got a simple method:

  def update
    user = User.authorized.find(params[:id])
    check_auth :edit_user, user
    update_from_params! user
    respond_with_ok
  end

After changing or adding some lines:

  def update
    user = User.authorized.find(params[:id])
    check_auth :edit_user, user
    update_from_params! user
    update_from_params! user
    update_from_params! user
    update_from_params! user
    update_from_params! user
    update_from_params! user
    update_from_params! user
    update_from_params! user
    update_from_params! user
    respond_with_ok
  end

There is a rubocop warning like "AbcSize" or "MethodLength":

app/controllers/users_controller.rb:37:3: C: Metrics/AbcSize: Assignment Branch Condition size for update is too high. [15.03/15]
  def update ...
  ^^^^^^^^^^
app/controllers/users_controller.rb:37:3: C: Metrics/MethodLength: Method has too many lines. [12/10]
  def update ...
  ^^^^^^^^^^

Because the issues are in the line where the method is defined and this line wasn't changed, the issue is not reported by pronto.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions