Skip to content

Bug Fix: ABC News#490

Merged
tavdog merged 1 commit intotronbyt:mainfrom
M0ntyP:ABC-News-v1.1
May 6, 2026
Merged

Bug Fix: ABC News#490
tavdog merged 1 commit intotronbyt:mainfrom
M0ntyP:ABC-News-v1.1

Conversation

@M0ntyP
Copy link
Copy Markdown
Contributor

@M0ntyP M0ntyP commented May 6, 2026

Added handling for when less than 5 stories in the feed

Added handling for when less than 5 stories in the feed
@M0ntyP M0ntyP requested a review from tavdog as a code owner May 6, 2026 02:41
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds version history to the docstring and implements logic to handle feeds with fewer than five headlines. Feedback includes removing the manual version history, renaming the file to match the directory name per naming conventions, and using list slicing with extend for a more idiomatic implementation.

Comment on lines +6 to +11

v1.0
First release

v1.1
Added handling for when less than 5 stories in the feed
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Remove the version history from the docstring. This information is typically managed via source control tags (e.g., Git) rather than manually maintained within the file. Additionally, the Starlark file should have the same base name as its containing directory (e.g., 'abcnews.star' instead of 'abc_news.star').

References
  1. The Starlark file containing the main() function should have the same base name as its containing directory.

Comment on lines +34 to 39
# just in case less than 5 stories in the feed
feed_length = min(len(title), 5)

for i in range(0, feed_length, 1):
desc = title[i]
description.append(desc)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The loop and manual length calculation can be simplified using list.extend() with a slice. Starlark supports slicing, which is more idiomatic and automatically handles cases where the list contains fewer than the requested number of elements.

Suggested change
# just in case less than 5 stories in the feed
feed_length = min(len(title), 5)
for i in range(0, feed_length, 1):
desc = title[i]
description.append(desc)
description.extend(title[:5])

@tavdog tavdog merged commit 9f9915a into tronbyt:main May 6, 2026
1 check 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.

2 participants