Sha256: 5cb06a162a1684262e751a0ef1ba3220ad029d2ab957bf97f2880d62c3e66b6b

Contents?: true

Size: 530 Bytes

Versions: 10

Compression:

Stored size: 530 Bytes

Contents

# frozen_string_literal: true

require "rubocop"

module RuboCop
  module Cop
    module Sorbet
      # This cop disallows using `T.unsafe` anywhere.
      #
      # @example
      #
      #   # bad
      #   T.unsafe(foo)
      #
      #   # good
      #   foo
      class ForbidTUnsafe < RuboCop::Cop::Cop
        def_node_matcher(:t_unsafe?, "(send (const nil? :T) :unsafe _)")

        def on_send(node)
          add_offense(node, message: "Do not use `T.unsafe`.") if t_unsafe?(node)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rubocop-sorbet-0.7.0 lib/rubocop/cop/sorbet/forbid_t_unsafe.rb
rubocop-sorbet-0.6.11 lib/rubocop/cop/sorbet/forbid_t_unsafe.rb
rubocop-sorbet-0.6.10 lib/rubocop/cop/sorbet/forbid_t_unsafe.rb
rubocop-sorbet-0.6.9 lib/rubocop/cop/sorbet/forbid_t_unsafe.rb
rubocop-sorbet-0.6.8 lib/rubocop/cop/sorbet/forbid_t_unsafe.rb
rubocop-sorbet-0.6.7 lib/rubocop/cop/sorbet/forbid_t_unsafe.rb
rubocop-sorbet-0.6.6 lib/rubocop/cop/sorbet/forbid_t_unsafe.rb
rubocop-sorbet-0.6.5 lib/rubocop/cop/sorbet/forbid_t_unsafe.rb
rubocop-sorbet-0.6.4 lib/rubocop/cop/sorbet/forbid_t_unsafe.rb
rubocop-sorbet-0.6.3 lib/rubocop/cop/sorbet/forbid_t_unsafe.rb