Sha256: 3aff1567eae71fad682325f0f291c84e16705c2802566033c6e2144ad563aabe

Contents?: true

Size: 776 Bytes

Versions: 16

Compression:

Stored size: 776 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # A scaffold for concrete forces.
    class Force
      attr_reader :cops

      def self.all
        @all ||= []
      end

      def self.inherited(subclass)
        super
        all << subclass
      end

      def self.force_name
        name.split('::').last
      end

      def initialize(cops)
        @cops = cops
      end

      def name
        self.class.force_name
      end

      def run_hook(method_name, *args)
        cops.each do |cop|
          next unless cop.respond_to?(method_name)

          cop.send(method_name, *args)
        end
      end

      def investigate(_processed_source)
        # Do custom processing and invoke #run_hook at arbitrary timing.
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
plaid-14.13.0 vendor/bundle/ruby/3.0.0/gems/rubocop-0.91.1/lib/rubocop/cop/force.rb
plaid-14.12.1 vendor/bundle/ruby/3.0.0/gems/rubocop-0.91.1/lib/rubocop/cop/force.rb
plaid-14.12.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.91.1/lib/rubocop/cop/force.rb
plaid-14.11.1 vendor/bundle/ruby/2.6.0/gems/rubocop-0.91.1/lib/rubocop/cop/force.rb
plaid-14.10.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.91.1/lib/rubocop/cop/force.rb
plaid-14.7.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.91.1/lib/rubocop/cop/force.rb
rubocop-1.0.0 lib/rubocop/cop/force.rb
rubocop-0.93.1 lib/rubocop/cop/force.rb
rubocop-0.93.0 lib/rubocop/cop/force.rb
rubocop-0.92.0 lib/rubocop/cop/force.rb
rubocop-0.91.1 lib/rubocop/cop/force.rb
rubocop-0.91.0 lib/rubocop/cop/force.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/rubocop-0.90.0/lib/rubocop/cop/force.rb
rubocop-0.90.0 lib/rubocop/cop/force.rb
rubocop-0.89.1 lib/rubocop/cop/force.rb
rubocop-0.89.0 lib/rubocop/cop/force.rb