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 KeyError: 'owner' in handle_check_run() #352

Merged
merged 1 commit into from
Oct 27, 2024
Merged

Fix KeyError: 'owner' in handle_check_run() #352

merged 1 commit into from
Oct 27, 2024

Conversation

hiroshinishio
Copy link
Collaborator

@hiroshinishio hiroshinishio commented Oct 27, 2024

Summary by Sourcery

Bug Fixes:

  • Fix a KeyError in handle_check_run() by adding a check for the presence of the 'owner' key in the repository data.

Copy link

sentry-io bot commented Oct 27, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: services/check_run_handler.py

Function Unhandled Issue
handle_check_run IndexError: list index out of range /webhook
Event Count: 79
handle_check_run KeyError: 'pull_requests' /webhook
Event Count: 2
handle_check_run KeyError: 'owner' /webhook
Event Count: 2

Did you find this useful? React with a 👍 or 👎

@hiroshinishio hiroshinishio merged commit edba9ff into main Oct 27, 2024
2 checks passed
@hiroshinishio hiroshinishio deleted the wes branch October 27, 2024 01:46
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 @hiroshinishio - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue 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 and I'll use the feedback to improve your reviews.

owner: Owner = repo.get("owner", {})
if owner is None:
msg = "Skipping because owner is not found"
print(colorize(text=msg, color="yellow"))
Copy link

Choose a reason for hiding this comment

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

suggestion: Consider using a logging framework instead of print for operational events

In a service handler, it's better to use proper logging for operational events rather than print statements. This would help with monitoring and debugging in production.

        logging.warning(msg)

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