Sha256: b54396a8f7505145df2afb38a0ba2e95e33f3dd23ad118e4217794a32d3c4950

Contents?: true

Size: 507 Bytes

Versions: 2

Compression:

Stored size: 507 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Lint
      # @example
      #   # bad
      #   HTTParty.get(..)
      #
      #   # good
      #   TimedRequest.get(...)
      class NoHTTParty < Cop
        MSG = "Prefer `TimedRequest` instead of raw `HTTParty` calls."

        def_node_matcher :is_HTTParty?, "(send (const nil? :HTTParty) ...)"

        def on_send(node)
          return unless is_HTTParty?(node)
          add_offense(node)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rf-stylez-1.0.3 lib/rubocop/cop/lint/no_http_party.rb
rf-stylez-1.0.2 lib/rubocop/cop/lint/no_http_party.rb