Class: RuboCop::Cop::Doctolib::NoAsymmetricalPunditAfterActions
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Doctolib::NoAsymmetricalPunditAfterActions
- Defined in:
- lib/rubocop/cop/doctolib/no_asymmetrical_pundit_after_actions.rb
Overview
Prevent uses of the ‘verify_authorized` and `verify_policy_scoped` after-action filters from Pundit, which potentially let some actions covered by neither after-action filter.
Constant Summary collapse
- MSG =
<<~MESSAGE.chomp.gsub("\n", ' ') Some actions may not be covered by either of `:verify_policy_scoped` or `:verify_authorized`. Prefer setting these with complementary `except` and `only` parameters. MESSAGE
Instance Method Summary collapse
Instance Method Details
#on_class(node) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/rubocop/cop/doctolib/no_asymmetrical_pundit_after_actions.rb', line 83 def on_class(node) verified_class?(node) do |policy_scoped, | policy_scoped = Verify.new policy_scoped = Verify.new return if policy_scoped.covers_all? return if .covers_all? return if only_superset_of_except? policy_scoped, return if disjoint_excepts? policy_scoped, add_offense policy_scoped.node add_offense .node end end |