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

update config.py and main.py #386

Merged
merged 1 commit into from
Jul 9, 2024
Merged

update config.py and main.py #386

merged 1 commit into from
Jul 9, 2024

Conversation

mraniki
Copy link
Owner

@mraniki mraniki commented Jul 9, 2024

Summary by Sourcery

This pull request addresses a bug in the get_order function in main.py, ensuring that the function correctly returns an order if found by any client.

  • Bug Fixes:
    • Fixed an issue where the function would return None if the first client did not have the order.

Copy link

sourcery-ai bot commented Jul 9, 2024

Reviewer's Guide by Sourcery

This pull request updates the get_order method in main.py to handle cases where the order returned by a client is None. The implementation now checks if the order is not None before returning it.


Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @mraniki - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@@ -208,4 +208,6 @@ async def get_order(

"""
for client in self.clients:
return await client.get_order(message)
order = await client.get_order(message)
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Potential issue with returning the first non-null order

The current implementation returns the first non-null order found. If there are multiple clients and the order from the first client is incomplete or incorrect, this could lead to issues. Consider whether additional validation or checks are needed before returning the order.

@@ -208,4 +208,6 @@ async def get_order(

"""
for client in self.clients:
return await client.get_order(message)
order = await client.get_order(message)
if order:
Copy link

Choose a reason for hiding this comment

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

suggestion: Clarify the condition for 'if order'

The condition 'if order' checks for a truthy value. Ensure that this condition is sufficient for your use case. If 'order' can be an empty object or have other falsy values that should still be considered valid, you might need a more specific check.

Suggested change
if order:
if order is not None and order != {}:

@mraniki mraniki merged commit e6b933d into main Jul 9, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant