Sha256: bfb0ea0b996704b03e63dd5651353153f06fc72a495d23a008a36b82fb019045
Contents?: true
Size: 675 Bytes
Versions: 1
Compression:
Stored size: 675 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module ThreadSafety # Avoid starting new threads. # # Let a framework like Sidekiq handle the threads. # # @example # # bad # Thread.new { do_work } class NewThread < Base MSG = 'Avoid starting new threads.' RESTRICT_ON_SEND = %i[new fork start].freeze # @!method new_thread?(node) def_node_matcher :new_thread?, <<~MATCHER (send (const {nil? cbase} :Thread) {:new :fork :start} ...) MATCHER def on_send(node) new_thread?(node) { add_offense(node) } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-thread_safety-0.6.0 | lib/rubocop/cop/thread_safety/new_thread.rb |