Skip to content

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

@maxim

Description

@maxim

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy