Skip to content

reader: unify common code between feed readers#4356

Open
gudvinr wants to merge 3 commits into
miniflux:mainfrom
gudvinr:feature/consistent_adapters
Open

reader: unify common code between feed readers#4356
gudvinr wants to merge 3 commits into
miniflux:mainfrom
gudvinr:feature/consistent_adapters

Conversation

@gudvinr

@gudvinr gudvinr commented May 23, 2026

Copy link
Copy Markdown
Contributor

I guess different readers were touched by different people in a very different circumstances.
As the result, sometimes code that does exactly the same looks different.

Here, some things were moved around to make code look consistent overall.

I've split everything into different commits but if this PR is too loaded I probably can split them into different PRs if needed. That was done just for the sake of not doing a rebase later.

Not sure how to correctly test for regressions, but I've noticed that only TestParseEntryWithMediaContent were failing and it seems like it was relying on the wrong behaviour in first place.


Have you followed these guidelines?

@gudvinr gudvinr marked this pull request as draft May 23, 2026 13:18
@gudvinr gudvinr force-pushed the feature/consistent_adapters branch from d3e0fab to 18f8101 Compare May 23, 2026 13:26
@gudvinr gudvinr marked this pull request as ready for review May 23, 2026 13:27
@gudvinr gudvinr force-pushed the feature/consistent_adapters branch 2 times, most recently from ea92440 to 90880db Compare May 24, 2026 14:11
@gudvinr gudvinr force-pushed the feature/consistent_adapters branch 2 times, most recently from 59e281d to cef05c4 Compare May 27, 2026 15:42
Comment thread internal/reader/atom/atom_10_adapter.go
Comment thread internal/reader/atom/atom_10_adapter.go Outdated
Comment thread internal/reader/rss/adapter.go
@gudvinr gudvinr force-pushed the feature/consistent_adapters branch from cef05c4 to 7fe5b99 Compare June 6, 2026 13:00
Every build feed method does similar things in a different way. That makes it harder to read these implementations.

Remove nesting creep in loops to make code simpler.
@gudvinr gudvinr force-pushed the feature/consistent_adapters branch 2 times, most recently from 9dbce15 to c98368c Compare June 6, 2026 16:21
@gudvinr gudvinr force-pushed the feature/consistent_adapters branch from c98368c to a3572f6 Compare June 6, 2026 16:22
label := strings.TrimSpace(category.Label)
if label != "" {
labels = append(labels, label)
func (mcl MediaCategoryList) LabelsSeq() iter.Seq[string] {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This (and ItunesChannelElement) modification wasn't planned. But I've noticed that these only used once each.

These intermediate slices are unnecessary as they only used to extract .Label (and .Text in case of itunes) from struct.

With iter.Seq we only get label and append to resulting tags slice without creating another slice.

@gudvinr gudvinr requested a review from fguillot June 6, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants