Skip to content

Commit

Permalink
docs(events): improve TODO for ‹project*› refactor
Browse files Browse the repository at this point in the history
Suggested-by: Laura Barcziová <[email protected]>
Signed-off-by: Matej Focko <[email protected]>
  • Loading branch information
mfocko committed Jan 29, 2025
1 parent 6c6fe8e commit 76fb62c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packit_service/events/event_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,19 @@ def project(self):
return self._project

def _add_project_object_and_event(self):
# TODO, do a better job
# Probably, try to recreate original classes.
# [TODO] Improve handling of this matching against hard-coded values.
# 1. Switching from hard-coded values to using ‹.event_type()› on the
# classes themselves would be possible, but that would introduce
# circular imports.
# 2. Better approach would be importing based on the ‹self.event_type›
# and inheriting a “mixin” within the event class that could handle
# this logic. However ‹self.project› (used below) is a property, and
# the return values are assigned to ‹self›. Also the type signature
# for the methods introduced by a mixin would be complicated, as the
# least amount of copy-paste basically leads to having both named
# arguments and ‹**kwargs› to catch any additional unused parameters.
# We would also lose silent fail on some of the currently ignored
# events (right now we log a warning).
if self.event_type in {
"github.pr.Action",
"pagure.pr.Action",
Expand Down

0 comments on commit 76fb62c

Please sign in to comment.