Sha256: ece321c94958284214fd50834c61ca7aa2e1f76284080af1258864dfe9440a76

Contents?: true

Size: 667 Bytes

Versions: 6

Compression:

Stored size: 667 Bytes

Contents

# frozen_string_literal: true

require "rubocop"

module RuboCop
  module Cop
    module AnyCable
      # Checks for periodical timers usage.
      #
      # @example
      #   # bad
      #   class MyChannel < ApplicationCable::Channel
      #     periodically(:do_something, every: 2.seconds)
      #   end
      #
      class PeriodicalTimers < RuboCop::Cop::Base
        MSG = "Periodical Timers are not supported in AnyCable"

        def_node_matcher :calls_periodically?, <<-PATTERN
          (send _ :periodically ...)
        PATTERN

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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
rubocop-anycable-rails-1.5.6 lib/anycable/rails/rubocop/cops/anycable/periodical_timers.rb
anycable-rails-core-1.5.6 lib/anycable/rails/rubocop/cops/anycable/periodical_timers.rb
rubocop-anycable-rails-1.6.0.rc.1 lib/anycable/rails/rubocop/cops/anycable/periodical_timers.rb
anycable-rails-core-1.6.0.rc.1 lib/anycable/rails/rubocop/cops/anycable/periodical_timers.rb
rubocop-anycable-rails-1.5.5 lib/anycable/rails/rubocop/cops/anycable/periodical_timers.rb
anycable-rails-core-1.5.5 lib/anycable/rails/rubocop/cops/anycable/periodical_timers.rb