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

Clarify dangers of Rails/LexicallyScopedActionFilter #6854

Merged
merged 2 commits into from Apr 4, 2019

Commits on Apr 3, 2019

  1. Clarify dangers of Rails/LexicallyScopedActionFilter

    This cop encourages users to define action methods in the same class as
    any before_, after_ or around_actions that refer to the action.
    
    However, the examples given don't account for the fact that behaviour
    might be defined in the superclass. Indeed, this sort of decoration is
    one of the main use cases for action decorators.
    
    If this is the case, then the empty action definitions shown in the docs
    will override the desired behaviour, and lead users to introduce bugs.
    This change emphasises this in the docs, and gives an example to
    encourage users to think about the inheritance chain.
    urbanautomaton committed Apr 3, 2019
    Configuration menu
    Copy the full SHA
    792e8ab View commit details
    Browse the repository at this point in the history
  2. Mark Rails/LexicallyScopedActionFilter as unsafe

    In the previous commit we documented an inheritance case in which the
    Rails/LexicallyScopedActionFilter cop recommends unsafe edits that have
    semantic implications.
    
    Since not everyone will see the documentation examples, we're also
    marking the cop as unsafe to signal that its recommendations should be
    treated carefully.
    urbanautomaton committed Apr 3, 2019
    Configuration menu
    Copy the full SHA
    a008bf6 View commit details
    Browse the repository at this point in the history