Sha256: c8fe94a1fa2679b817c814c38132e5aafcb5fa979198c4fed31aa7ba3623779c

Contents?: true

Size: 606 Bytes

Versions: 16

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

require "rubocop"

module RuboCop
  module Cop
    module Sorbet
      # Disallows using `T.unsafe` anywhere.
      #
      # @example
      #
      #   # bad
      #   T.unsafe(foo)
      #
      #   # good
      #   foo
      class ForbidTUnsafe < RuboCop::Cop::Base
        MSG = "Do not use `T.unsafe`."
        RESTRICT_ON_SEND = [:unsafe].freeze

        # @!method t_unsafe?(node)
        def_node_matcher(:t_unsafe?, "(send (const nil? :T) :unsafe _)")

        def on_send(node)
          add_offense(node) if t_unsafe?(node)
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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