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

IgnoredSkipActionFilterOption doesn't catch a problem when there are multiple positional arguments #1303

Closed
maxim opened this issue Jun 28, 2024 · 0 comments · Fixed by #1304

Comments

@maxim
Copy link

maxim commented Jun 28, 2024

The IgnoredSkipActionFilterOption fails to catch a problem when skip_before_action is given multiple names (positional arguments).


Expected behavior

Both of these should be considered "bad" by IgnoredSkipActionFilterOption.

  1. skip_before_action :arg1, only: :show, if: :trusted_login?
  2. skip_before_action :arg1, :arg2, only: :show, if: :trusted_login?

Actual behavior

  1. is considered "bad"
  2. is considered "good"

Steps to reproduce the problem

  1. Make sure that Rails/IgnoredSkipActionFilterOption is enabled on all files.

  2. Write a file in things_controller.rb as follows:

    class ThingsController < ApplicationController
      skip_before_action :arg1, :arg2, only: :show, if: :trusted_login?
    end
  3. Run rubocop: it will not find an issue.

  4. Remove , :arg2

  5. Run rubocop: it will find an issue.

RuboCop version

❯ bin/rubocop -V
1.59.0 (using Parser 3.3.0.4, rubocop-ast 1.30.0, running on ruby 3.2.2) [arm64-darwin22]
  - rubocop-minitest 0.34.4
  - rubocop-performance 1.20.2
  - rubocop-rails 2.23.1
  - rubocop-rake 0.6.0
  - rubocop-thread_safety 0.5.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant