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
rubocop-1.42.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.41.1 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.41.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.40.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.39.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.38.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.37.1 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.37.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.36.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.35.1 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.35.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.34.1 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.34.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.33.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.32.0 lib/rubocop/cop/mixin/def_node.rb
rubocop-1.31.2 lib/rubocop/cop/mixin/def_node.rb