Sha256: b2df187bffbe65095deedf709c461d89a6cc6c0185b199f31d35e9abd4cc35e2

Contents?: true

Size: 690 Bytes

Versions: 7

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Rake
      module Helper
        module ClassDefinition
          extend NodePattern::Macros
          extend self

          def_node_matcher :class_definition?, <<~PATTERN
            {
              class module sclass
              (block
                (send (const {nil? cbase} {:Class :Module}) :new)
                args
                _
              )
            }
          PATTERN

          def in_class_definition?(node)
            node.each_ancestor(:class, :module, :sclass, :block).any? do |a|
              class_definition?(a)
            end
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/rubocop-rake-0.6.0/lib/rubocop/cop/rake/helper/class_definition.rb
rubocop-rake-0.6.0 lib/rubocop/cop/rake/helper/class_definition.rb
rubocop-rake-0.5.1 lib/rubocop/cop/rake/helper/class_definition.rb
rubocop-rake-0.5.0 lib/rubocop/cop/rake/helper/class_definition.rb
rubocop-rake-0.4.0 lib/rubocop/cop/rake/helper/class_definition.rb
rubocop-rake-0.3.1 lib/rubocop/cop/rake/helper/class_definition.rb
rubocop-rake-0.3.0 lib/rubocop/cop/rake/helper/class_definition.rb