-
Notifications
You must be signed in to change notification settings - Fork 220
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
Improve clarity for referenced
and cross-referenced
timeline events
#1182
Conversation
In general this LGTM, but...
... I have to admit I'm not a fan of such one-off methods, because it makes one jump back-and-forth through the code when following the logic. |
I think there are a few compelling reasons to extract those sections in separate methods:
About the jumping back-and-forth, and I don't think that's the case here. The details of those sections aren't really important to know if you're just following the logic, and furthermore it seems to me that the sections are changed independently of each other in most cases (so it's unlikely you'll need to jump around), and having each of them extracted helps (me at least) focusing on one piece at a time. Just to be clear, I don't want to impose my way of structuring code here 😅, my goal was just to avoid to others the struggle I've had when first approaching the code. |
How about adding comments as a (meaningful) compromise? |
Definitely better than nothing for someone reading the code for the first time, but you won't get the aforementioned benefits about explicit scoping, "hiding" unnecessary details when just following the logic, and making the method size more manageable. |
This PR makes the following improvements to the way
referenced
andcross-referenced
timeline events are displayed:referenced
: display also repository owner and name together with the SHA of the commit that referenced the issue/PR, if it belongs to another repository.I've also reworded the message for the event since I've discovered that references from commit comments (and not only from commit messages) appear as
referenced
events too (see this for an example), and therefore the message "added commit [] that referenced this issue" could have been misleading.cross-referenced
: display also repository owner and name together with the number of the issue that referenced the issue/PR, if it belongs to another repository (like GitHub does, e.g.dotnet/runtime#12456
).I've also extracted a few methods to improve code readability.