Sha256: 3d12d146ced445ba038a90ec22fdccb0e0ef09f1dc55caaf1ddaf23ecccc7dd2

Contents?: true

Size: 783 Bytes

Versions: 236

Compression:

Stored size: 783 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.public_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

236 entries across 227 versions & 19 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/force.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/force.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/force.rb
rubocop-1.63.4 lib/rubocop/cop/force.rb
rubocop-1.63.3 lib/rubocop/cop/force.rb
rubocop-1.63.2 lib/rubocop/cop/force.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/force.rb
rubocop-1.63.1 lib/rubocop/cop/force.rb
rubocop-1.63.0 lib/rubocop/cop/force.rb
bison-0.1.0 vendor/bundle/ruby/3.2.0/gems/rubocop-1.62.1/lib/rubocop/cop/force.rb
rubocop-1.62.1 lib/rubocop/cop/force.rb
rubocop-1.62.0 lib/rubocop/cop/force.rb
rubocop-1.61.0 lib/rubocop/cop/force.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.2/lib/rubocop/cop/force.rb
rubocop-1.60.2 lib/rubocop/cop/force.rb
study_line-0.2.7 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/force.rb
study_line-0.2.6 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/force.rb
study_line-0.2.5 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/force.rb
study_line-0.2.4 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/force.rb
study_line-0.2.3 vendor/bundle/ruby/3.2.0/gems/rubocop-1.60.0/lib/rubocop/cop/force.rb