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

Backport SolidusBraintree README changes to v2.x #134

Merged
merged 6 commits into from
Mar 16, 2023

Conversation

gsmendoza
Copy link
Contributor

@gsmendoza gsmendoza commented Mar 16, 2023

Summary

Closes #131.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@gsmendoza gsmendoza self-assigned this Mar 16, 2023
@gsmendoza gsmendoza requested a review from kennyadsl March 16, 2023 07:07
Offenses:

app/models/solidus_braintree/transaction.rb:20:21: C: [Correctable] Style/InverseMethods: Use invalid? instead of inverting valid?.
      if address && !address.valid?
                    ^^^^^^^^^^^^^^^
app/models/solidus_braintree/transaction_import.rb:12:57: C: [Correctable] Style/InverseMethods: Use invalid? instead of inverting valid?.
      errors.add("Address", "is invalid") if address && !address.valid?
                                                        ^^^^^^^^^^^^^^^
app/models/solidus_braintree/transaction_import.rb:14:10: C: [Correctable] Style/InverseMethods: Use invalid? instead of inverting valid?.
      if !transaction.valid?
         ^^^^^^^^^^^^^^^^^^^
Offenses:

app/models/solidus_braintree/transaction.rb:20:10: C: [Correctable] Style/SafeNavigation: Use safe navigation (&.) instead of checking if an object exists before calling the method.
      if address && address.invalid?
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/solidus_braintree/transaction_import.rb:12:46: C: [Correctable] Style/SafeNavigation: Use safe navigation (&.) instead of checking if an object exists before calling the method.
      errors.add("Address", "is invalid") if address && address.invalid?
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@gsmendoza gsmendoza force-pushed the gsmendoza/131-backport-readme-changes branch from 280886a to 999fbc4 Compare March 16, 2023 07:17
@@ -17,7 +17,7 @@ class Transaction
unless payment_method.is_a? SolidusBraintree::Gateway
errors.add(:payment_method, 'Must be braintree')
end
if address && !address.valid?
if address&.invalid?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cherry-picked these commits to fix the RuboCop offenses in the CI.

@@ -9,9 +9,9 @@ class InvalidImportError < StandardError; end
include ActiveModel::Model

validate do
errors.add("Address", "is invalid") if address && !address.valid?
errors.add("Address", "is invalid") if address&.invalid?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cherry-picked these commits to fix the RuboCop offenses in the CI.

@kennyadsl kennyadsl merged commit 4944b7e into v2.x Mar 16, 2023
@kennyadsl kennyadsl deleted the gsmendoza/131-backport-readme-changes branch March 16, 2023 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants