Sha256: a75e8a6bc3b140a95bb3da64bd34141bcf7cfcb52b1077fc0fcb3396742dfc7f

Contents?: true

Size: 631 Bytes

Versions: 5

Compression:

Stored size: 631 Bytes

Contents

# frozen_string_literal: true

require "rubocop/cop/style/mutable_constant"

module RuboCop
  module Cop
    module Sorbet
      module MutableConstantSorbetAwareBehaviour
        def self.prepended(base)
          base.def_node_matcher(:t_let, <<~PATTERN)
            (send (const nil? :T) :let $_constant _type)
          PATTERN
        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

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-sorbet-0.7.0 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.6.11 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.6.10 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.6.9 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb
rubocop-sorbet-0.6.8 lib/rubocop/cop/sorbet/mutable_constant_sorbet_aware_behaviour.rb