Sha256: c9f13edad20f3b2e875363e779693d6fa8c7719e315c14fe6c08ba15f7a48059

Contents?: true

Size: 619 Bytes

Versions: 56

Compression:

Stored size: 619 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # Common functionality for checking def nodes.
    module DefNode
      extend NodePattern::Macros
      include VisibilityHelp

      private

      def non_public?(node)
        non_public_modifier?(node.parent) || preceding_non_public_modifier?(node)
      end

      def preceding_non_public_modifier?(node)
        node_visibility(node) != :public
      end

      # @!method non_public_modifier?(node)
      def_node_matcher :non_public_modifier?, <<~PATTERN
        (send nil? {:private :protected} ({def defs} ...))
      PATTERN
    end
  end
end

Version data entries

56 entries across 49 versions & 8 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/def_node.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/def_node.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/def_node.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/def_node.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.31.2/lib/rubocop/cop/mixin/def_node.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.52.1/lib/rubocop/cop/mixin/def_node.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.36.0/lib/rubocop/cop/mixin/def_node.rb
rubocop-1.55.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.54.2 lib/rubocop/cop/mixin/def_node.rb
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/rubocop-1.54.1/lib/rubocop/cop/mixin/def_node.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/rubocop-1.52.1/lib/rubocop/cop/mixin/def_node.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/rubocop-1.54.1/lib/rubocop/cop/mixin/def_node.rb
rubocop-1.54.1 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.54.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.53.1 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.53.0 lib/rubocop/cop/mixin/def_node.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.36.0/lib/rubocop/cop/mixin/def_node.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.31.2/lib/rubocop/cop/mixin/def_node.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.52.1/lib/rubocop/cop/mixin/def_node.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/def_node.rb