Class: RuboCop::Cop::Neeto::FaradayOverHttparty

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/neeto/faraday_over_httparty.rb

Overview

HTTParty has been removed from all Neeto applications in favor of Faraday, which is already available. This cop flags any attempt to add the ‘httparty` gem to a Gemfile.

Examples:

FaradayOverHttparty: true (default)

# Disallows adding the `httparty` gem.

# bad
gem "httparty"

# good
gem "faraday"

Constant Summary collapse

MSG =
"Do not add the `httparty` gem. Use `faraday` instead, which is " \
"already available in the application. See " \
"https://github.com/neetozone/neeto-engineering/issues/1862 for more details."
RESTRICT_ON_SEND =
%i[gem].freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



30
31
32
33
34
# File 'lib/rubocop/cop/neeto/faraday_over_httparty.rb', line 30

def on_send(node)
  httparty_gem?(node) do |gem_name|
    add_offense(node) if gem_name.casecmp?("httparty")
  end
end