Class: RuboCop::Cop::Netlify::RequireScopeDuplication
- Inherits:
-
RequireScopeBase
- Object
- RuboCop::Cop
- RequireScopeBase
- RuboCop::Cop::Netlify::RequireScopeDuplication
- Defined in:
- lib/rubocop/cop/netlify/require_scope_duplication.rb
Overview
This cop checks OAuth scope definition duplication
Constant Summary
Constants inherited from RequireScopeBase
RuboCop::Cop::Netlify::RequireScopeBase::RESTRICT_ON_SEND
Instance Method Summary collapse
Methods inherited from RequireScopeBase
Instance Method Details
#on_def(node) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/rubocop/cop/netlify/require_scope_duplication.rb', line 32 def on_def(node) return unless @is_controller return unless @method_protection == :public require_scopes = require_scopes_for_method(node.method_name) if require_scopes.size > 1 add_offense(require_scopes.last[:node], message: "Multiple overlapping definitions: #{require_scopes.map { |rs| rs[:scopes].inspect }.join(" and ")}.") end end |