Sha256: d8d573d3a1be11896979011f7be7053e2228a7c1d950c423cdebb7d0a97e2825
Contents?: true
Size: 1.12 KB
Versions: 16
Compression:
Stored size: 1.12 KB
Contents
# encoding: utf-8 # frozen_string_literal: true require "rubocop" module RuboCop module Cop module Sorbet # Correct superclass `send` expressions by constant literals. # # Sorbet, the static checker, is not (yet) able to support constructs on the # following form: # # ```ruby # class Foo < send_expr; end # ``` # # Multiple occurences of this can be found in Shopify's code base like: # # ```ruby # class ShopScope < Component::TrustedIdScope[ShopIdentity::ShopId] # ``` # or # ```ruby # class ApiClientEligibility < Struct.new(:api_client, :match_results, :shop) # ``` class ForbidSuperclassConstLiteral < RuboCop::Cop::Base MSG = "Superclasses must only contain constant literals" # @!method dynamic_superclass?(node) def_node_matcher :dynamic_superclass?, <<-PATTERN (class (const ...) $(send ...) ...) PATTERN def on_class(node) dynamic_superclass?(node) do |superclass| add_offense(superclass) end end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems