Sha256: 43993984336989411203f787a02ae9069b469eb56a6d5e29cc2c2a77da8f6bd6

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

# typed: strict

require 'rubocop-sorbet'

module RuboCop
  module Cop
    module Packs
      # This cop helps ensure that each pack's public API is strictly typed, enforcing strong boundaries.
      #
      # @example
      #
      #   # bad
      #   # packs/foo/app/public/foo.rb
      #   # typed: false
      #   module Foo; end
      #
      #   # good
      #   # packs/foo/app/public/foo.rb
      #   # typed: strict
      #   module Foo; end
      #
      class TypedPublicApi < Sorbet::StrictSigil
        #
        # This inherits from `Sorbet::StrictSigil` and doesn't change any behavior of it.
        # The only reason we do this is so that configuration for this cop can live under a different cop namespace.
        # This prevents this cop's configuration from clashing with other configurations for the same cop.
        # A concrete example of this would be if a user is using this package protection to make sure public APIs are typed,
        # and separately the application as a whole requiring strict typing in certain parts of the application.
        #
        # To prevent problems associated with needing to manage identical configurations for the same cop, we simply call it
        # something else in the context of this protection.
        #
        # We can apply this same pattern if we want to use other cops in the context of package protections and prevent clashing.
        #
        extend T::Sig
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-packs-0.0.11 lib/rubocop/cop/packs/typed_public_api.rb
rubocop-packs-0.0.10 lib/rubocop/cop/packs/typed_public_api.rb
rubocop-packs-0.0.9 lib/rubocop/cop/packs/typed_public_api.rb
rubocop-packs-0.0.7 lib/rubocop/cop/packs/typed_public_api.rb