나는이 return if amount == 0
과 같은 방법을 가지고 있으며 rubocop은 return if amount.zero?
과 같아야한다고 불평하고 있습니다. 어떻게 그 방법을 건너 뛰어도 되겠습니까?방법에 대한 Rubocop 불만 사용 안함
rubocop
StringLiterals:
EnforcedStyle: double_quotes
Enabled: true
Style/FrozenStringLiteralComment:
Enabled: false
Style/TrailingCommaInLiteral:
Enabled: false
Style/TrailingCommaInArguments:
Enabled: false
Style/CaseEquality:
Enabled: false
Documentation:
Description: "Document classes and non-namespace modules."
Enabled: false
Metrics/MethodLength:
CountComments: false
Max: 15
Rails/Delegate:
Enabled: false
AllCops:
Exclude:
- db/**/*
- config/**/*
- script/**/*
- vendor/**/*
- bin/**/*
- Rakefile
- spec/spec_helper.rb
- spec/rails_helper.rb
- spec/teaspoon_env.rb
TargetRubyVersion: 2.3
Rails:
Enabled: true
submit_ticket_payment.rb 그래서 기본적으로 내가 그 특정 인스턴스에 대해 걱정하지 않은 방법
def call
return if amount == 0
Stripe::Charge.create(
amount: amount,
currency: "usd",
description: event_name,
receipt_email: context.rsvp.email,
source: context.token,
statement_descriptor: event_name
)
rescue Stripe::StripeError
context.fail!
end
: 여기 내 .rubocop.yml은?
어리석은 질문이지만 그 제안을 따르지 않는 이유는 무엇입니까? – sevenseacat
'zero?'메소드는 기대가 사실이라면 반환 할 것이고, 나는'== 0'의 명시적인 성격을 더 좋아한다. – Bitwise