Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Rubocop UnusedMethodArgument #3646

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ Lint/RescueException:
Lint/UnusedBlockArgument:
Enabled: false

# Offense count: 284
# Cop supports --auto-correct.
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
Lint/UnusedMethodArgument:
Enabled: false

# Offense count: 1418
Metrics/AbcSize:
Max: 192
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateway.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def supports_scrubbing?
false
end

def scrub(transcript)
def scrub(_transcript)
raise 'This gateway does not support scrubbing.'
end

Expand Down
6 changes: 3 additions & 3 deletions lib/active_merchant/billing/gateways/adyen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,12 @@ def capture_options(options)
options
end

def add_reference(post, authorization, options = {})
def add_reference(post, authorization, _options = {})
_, psp_reference, _ = authorization.split('#')
post[:originalReference] = single_reference(authorization) || psp_reference
end

def add_original_reference(post, authorization, options = {})
def add_original_reference(post, authorization, _options = {})
original_psp_reference, _, _ = authorization.split('#')
post[:originalReference] = single_reference(authorization) || original_psp_reference
end
Expand Down Expand Up @@ -578,7 +578,7 @@ def init_post(options = {})
post
end

def post_data(action, parameters = {})
def post_data(_action, parameters = {})
JSON.generate(parameters)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/allied_wallet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def capture(amount, authorization, options={})
commit(:capture, post)
end

def void(authorization, options={})
def void(authorization, _options={})
post = {}
add_reference(post, authorization, :void)

Expand Down
6 changes: 3 additions & 3 deletions lib/active_merchant/billing/gateways/authorize_net.rb
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def camel_case_lower(key)
String(key).split('_').inject([]) { |buffer, e| buffer.push(buffer.empty? ? e : e.capitalize) }.join
end

def add_settings(xml, source, options)
def add_settings(xml, _source, options)
xml.transactionSettings do
if options[:recurring]
xml.setting do
Expand Down Expand Up @@ -754,7 +754,7 @@ def names_from(payment_source, address, options)
end
end

def state_from(address, options)
def state_from(address, _options)
if ['US', 'CA'].include?(address[:country])
address[:state] || 'NC'
else
Expand Down Expand Up @@ -959,7 +959,7 @@ def success_from(action, response)
end
end

def message_from(action, response, avs_result, cvv_result)
def message_from(_action, response, avs_result, cvv_result)
if response[:response_code] == DECLINED
if CARD_CODE_ERRORS.include?(cvv_result.code)
return cvv_result.message
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/authorize_net_cim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ def build_get_customer_profile_request(xml, options)
xml.target!
end

def build_get_customer_profile_ids_request(xml, options)
def build_get_customer_profile_ids_request(xml, _options)
xml.target!
end

Expand Down
4 changes: 2 additions & 2 deletions lib/active_merchant/billing/gateways/bank_frick.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def refund(money, authorization, options={})
commit('refund', post)
end

def void(authorization, options={})
def void(authorization, _options={})
post = {}
post[:authorization] = authorization

Expand All @@ -89,7 +89,7 @@ def add_customer_data(post, options)
post[:ip] = options[:ip] || '0.0.0.0'
end

def add_address(post, creditcard, options)
def add_address(post, _creditcard, options)
if address = options[:billing_address] || options[:address]
post[:address] = address[:address1].to_s
post[:company] = address[:company].to_s
Expand Down
4 changes: 2 additions & 2 deletions lib/active_merchant/billing/gateways/banwire.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def add_order_data(post, options)
post[:concept] = options[:description]
end

def add_address(post, creditcard, options)
def add_address(post, _creditcard, options)
post[:address] = options[:billing_address][:address1]
post[:post_code] = options[:billing_address][:zip]
end
Expand All @@ -81,7 +81,7 @@ def parse(body)
JSON.parse(body)
end

def commit(money, parameters)
def commit(_money, parameters)
raw_response = ssl_post(URL, post_data(parameters))
begin
response = parse(raw_response)
Expand Down
4 changes: 2 additions & 2 deletions lib/active_merchant/billing/gateways/barclaycard_smartpay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def credit_card_hash(creditcard)
hash
end

def modification_request(reference, options)
def modification_request(reference, _options)
hash = {}
hash[:merchantAccount] = @options[:merchant]
hash[:originalReference] = psp_reference_from(reference)
Expand All @@ -332,7 +332,7 @@ def psp_reference_from(authorization)
authorization.nil? ? nil : authorization.split('#').first
end

def payment_request(money, options)
def payment_request(_money, options)
hash = {}
hash[:merchantAccount] = @options[:merchant]
hash[:reference] = options[:order_id]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def capture(money, authorization, options = {})
commit(post)
end

def refund(money, source, options = {})
def refund(money, source, _options = {})
post = {}
reference, _, type = split_auth(source)
add_reference(post, reference)
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/blue_pay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def commit(action, money, fields, options = {})
parse(ssl_post(url, post_data(action, fields)))
end

def parse_recurring(response_fields, opts={}) # expected status?
def parse_recurring(response_fields, _opts={}) # expected status?
parsed = {}
response_fields.each do |k, v|
mapped_key = REBILL_FIELD_MAP.include?(k) ? REBILL_FIELD_MAP[k] : k
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/blue_snap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def avs_lookup_key(p)
"line1: #{p['avs-response-code-address']}, zip: #{p['avs-response-code-zip']}, name: #{p['avs-response-code-name']}"
end

def success_from(action, response)
def success_from(_action, response)
(200...300).cover?(response.code.to_i)
end

Expand Down
18 changes: 9 additions & 9 deletions lib/active_merchant/billing/gateways/bogus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def credit(money, paysource, options = {})
end
end

def refund(money, reference, options = {})
def refund(money, reference, _options = {})
money = amount(money)
case reference
when /1$/
Expand All @@ -67,7 +67,7 @@ def refund(money, reference, options = {})
end
end

def capture(money, reference, options = {})
def capture(money, reference, _options = {})
money = amount(money)
case reference
when /1$/
Expand All @@ -79,7 +79,7 @@ def capture(money, reference, options = {})
end
end

def void(reference, options = {})
def void(reference, _options = {})
case reference
when /1$/
raise Error, VOID_ERROR_MESSAGE
Expand All @@ -90,7 +90,7 @@ def void(reference, options = {})
end
end

def store(paysource, options = {})
def store(paysource, _options = {})
case normalize(paysource)
when /1$/
Response.new(true, SUCCESS_MESSAGE, {billingid: '1'}, test: true, authorization: AUTHORIZATION)
Expand All @@ -101,7 +101,7 @@ def store(paysource, options = {})
end
end

def unstore(reference, options = {})
def unstore(reference, _options = {})
case reference
when /1$/
Response.new(true, SUCCESS_MESSAGE, {}, test: true)
Expand All @@ -114,7 +114,7 @@ def unstore(reference, options = {})

private

def authorize_emv(money, paysource, options = {})
def authorize_emv(money, paysource, _options = {})
money = amount(money)
case money
when /00$/
Expand All @@ -126,7 +126,7 @@ def authorize_emv(money, paysource, options = {})
end
end

def authorize_swipe(money, paysource, options = {})
def authorize_swipe(money, paysource, _options = {})
money = amount(money)
case normalize(paysource)
when /1$/, AUTHORIZATION
Expand All @@ -138,7 +138,7 @@ def authorize_swipe(money, paysource, options = {})
end
end

def purchase_emv(money, paysource, options = {})
def purchase_emv(money, paysource, _options = {})
money = amount(money)
case money
when /00$/
Expand All @@ -150,7 +150,7 @@ def purchase_emv(money, paysource, options = {})
end
end

def purchase_swipe(money, paysource, options = {})
def purchase_swipe(money, paysource, _options = {})
money = amount(money)
case normalize(paysource)
when /1$/, AUTHORIZATION
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/borgun.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def envelope(mode)
EOS
end

def url(action)
def url(_action)
(test? ? test_url : live_url)
end

Expand Down
6 changes: 3 additions & 3 deletions lib/active_merchant/billing/gateways/braintree_blue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def refund(*args)
end
end

def void(authorization, options = {})
def void(authorization, _options = {})
commit do
response_from_result(@braintree_gateway.transaction.void(authorization))
end
Expand Down Expand Up @@ -333,7 +333,7 @@ def map_address(address)
mapped
end

def commit(&block)
def commit
yield
rescue Braintree::BraintreeError => ex
Response.new(false, ex.class.to_s)
Expand Down Expand Up @@ -662,7 +662,7 @@ def xid_or_ds_trans_id(three_d_secure_opts)
end
end

def add_stored_credential_data(parameters, credit_card_or_vault_id, options)
def add_stored_credential_data(parameters, _credit_card_or_vault_id, options)
return unless (stored_credential = options[:stored_credential])

parameters[:external_vault] = {}
Expand Down
4 changes: 2 additions & 2 deletions lib/active_merchant/billing/gateways/bridge_pay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def refund(amount, authorization, options={})
commit(post)
end

def void(authorization, options={})
def void(authorization, _options={})
post = initialize_required_fields('Void')

add_reference(post, authorization)
Expand All @@ -74,7 +74,7 @@ def verify(creditcard, options = {})
end
end

def store(creditcard, options={})
def store(creditcard, _options={})
post = initialize_required_fields('')
post[:transaction] = 'Create'
post[:CardNumber] = creditcard.number
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/cams.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def refund(money, authorization, options={})
commit('refund', post)
end

def void(authorization, options={})
def void(authorization, _options={})
post = {}
add_reference(post, authorization)
commit('void', post)
Expand Down
6 changes: 3 additions & 3 deletions lib/active_merchant/billing/gateways/card_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ def capture(money, authorization, options = {})
commit('capture', post)
end

def refund(money, authorization, options = {})
def refund(money, authorization, _options = {})
post = {}
add_money(post, money)
add_reference(post, authorization)
commit('refund', post)
end

def void(authorization, options = {})
def void(authorization, _options = {})
post = {}
add_reference(post, authorization)
commit('void', post)
Expand All @@ -140,7 +140,7 @@ def store(payment, options = {})
commit('profile', post)
end

def unstore(authorization, options = {})
def unstore(authorization, _options = {})
account_id, profile_id = authorization.split('|')
commit('profile', {},
verb: :delete,
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/card_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def currency_code(currency)
CURRENCY_CODES[currency]
end

def post_data(action, parameters = {})
def post_data(_action, parameters = {})
parameters.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
end

Expand Down
6 changes: 3 additions & 3 deletions lib/active_merchant/billing/gateways/cardknox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ def authorize(amount, source, options={})
commit(:authorization, source_type(source), post)
end

def capture(amount, authorization, options = {})
def capture(amount, authorization, _options = {})
post = {}
add_reference(post, authorization)
add_amount(post, amount)
commit(:capture, source_type(authorization), post)
end

def refund(amount, authorization, options={})
def refund(amount, authorization, _options={})
post = {}
add_reference(post, authorization)
add_amount(post, amount)
commit(:refund, source_type(authorization), post)
end

def void(authorization, options = {})
def void(authorization, _options = {})
post = {}
add_reference(post, authorization)
commit(:void, source_type(authorization), post)
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/cc5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def build_capture_request(money, authorization, options = {})
end
end

def build_void_request(authorization, options = {})
def build_void_request(authorization, _options = {})
xml = Builder::XmlMarkup.new indent: 2

xml.tag! 'CC5Request' do
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/checkout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def verify(credit_card, options={})

private

def add_credentials(xml, options)
def add_credentials(xml, _options)
xml.merchantid_ @options[:merchant_id]
xml.password_ @options[:password]
end
Expand Down
Loading