Sha256: 4540e19757bb01b856ea9c3c68987c2881191ea79b45ffdfed8e297e0a3501e6
Contents?: true
Size: 1.08 KB
Versions: 12
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module RuboCop module Cop module Sorbet # Mixin for writing cops for signatures, providing a `signature?` node matcher and an `on_signature` trigger. module SignatureHelp extend RuboCop::NodePattern::Macros # @!method signature?(node) def_node_matcher(:signature?, <<~PATTERN) (block (send {nil? #with_runtime? #without_runtime?} :sig (sym :final)? ) (args) ...) PATTERN # @!method with_runtime?(node) def_node_matcher(:with_runtime?, <<~PATTERN) (const (const {nil? cbase} :T) :Sig) PATTERN # @!method without_runtime?(node) def_node_matcher(:without_runtime?, <<~PATTERN) (const (const (const {nil? cbase} :T) :Sig) :WithoutRuntime) PATTERN def on_block(node) on_signature(node) if signature?(node) end alias_method :on_numblock, :on_block def on_signature(_node) # To be defined by cop class as needed end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems