Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Method cops not found when changing the method #46

Open
alexkuebo opened this issue Jan 29, 2020 · 1 comment
Open

Method cops not found when changing the method #46

alexkuebo opened this issue Jan 29, 2020 · 1 comment
Labels

Comments

@alexkuebo
Copy link

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.

@ashkulz ashkulz added the bug label Jan 31, 2021
@ashkulz
Copy link
Member

ashkulz commented Jan 31, 2021

That's a bit tricky, as it's not part of the diff. Not sure there's an easy way to detect this without parsing the file itself, though 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants