Sha256: fde2eeb363d06f7198c52d3db9336cce334f8be04b298c05a6e5fce4f7cf8351
Contents?: true
Size: 1.27 KB
Versions: 12
Compression:
Stored size: 1.27 KB
Contents
# frozen-string-literal: true require_relative '../rubocop' unless defined?(RuboCop::Cop::StatsD) module RuboCop module Cop module StatsD # This Rubocop will check for specifying the `as_dist: true` keyword argument on `StatsD.measure` # and `statsd_measure`. This argument is deprecated. Instead, you can use `StatsD.distribution` # (or `statsd_distribution`) directly. # # To run this cop on your codebase: # # rubocop --require `bundle show statsd-instrument`/lib/statsd/instrument/rubocop.rb \ # --only StatsD/MeasureAsDistArgument # # This cop will not autocorrect offenses. class MeasureAsDistArgument < Cop include RuboCop::Cop::StatsD MSG = <<~MSG Do not use StatsD.measure(..., as_dist: true). This is deprecated. Use StatsD.distribution (or statsd_distribution) instead. MSG def on_send(node) if metric_method?(node) && node.method_name == :measure add_offense(node) if has_keyword_argument?(node, :as_dist) end if metaprogramming_method?(node) && node.method_name == :statsd_measure add_offense(node) if has_keyword_argument?(node, :as_dist) end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems