Sha256: 5cb38e0185b2eda79616affeb78749e8a90ff7a277f22c09fe510fadecd528fb

Contents?: true

Size: 706 Bytes

Versions: 16

Compression:

Stored size: 706 Bytes

Contents

# frozen_string_literal: true

require "rubocop/cop/style/mutable_constant"

module RuboCop
  module Cop
    module Sorbet
      module MutableConstantSorbetAwareBehaviour
        class << self
          def prepended(base)
            # @!method t_let(node)
            base.def_node_matcher(:t_let, <<~PATTERN)
              (send (const nil? :T) :let $_constant _type)
            PATTERN
          end
        end

        def on_assignment(value)
          t_let(value) do |constant|
            value = constant
          end

          super(value)
        end
      end
    end
  end
end

RuboCop::Cop::Style::MutableConstant.prepend(
  RuboCop::Cop::Sorbet::MutableConstantSorbetAwareBehaviour,
)

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rubocop-sorbet-0.8.7 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.8.6 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.8.5 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.8.4 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.8.3 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.8.2 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.8.1 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.8.0 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.7.8 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.7.7 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.7.6 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.7.5 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.7.4 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.7.3 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.7.2 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.7.1 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb