Skip to content

feat!: Refactor EnvelopeFromPart()'s scope#392

Merged
jhillyerd merged 3 commits intojhillyerd:mainfrom
bgedney:main
Apr 29, 2026
Merged

feat!: Refactor EnvelopeFromPart()'s scope#392
jhillyerd merged 3 commits intojhillyerd:mainfrom
bgedney:main

Conversation

@bgedney
Copy link
Copy Markdown
Contributor

@bgedney bgedney commented Apr 7, 2026

Summary

Refactor EnvelopeFromPart()'s scope so that the functions's scope of work is more aligned to the root aspect of a provided part:

  • Extracted the functionality from EnvelopeFromPart which gathered errors from any/all nested/child/sibling parts into a new method on enmime.Envelope called GatherNestedErrors(). GatherNestedErrors() is also implemented in ReadEnvelope().
  • Also extracted the previous functionality into a new method on the Envelope type - GatherNestedErrors(). Also implemented GatherNestedErrors() within ReadEnvelope() after the call to EnvelopeFromPart() and added supporting test cases.

Why

The scope of the current form of EnvelopeFromPart is inconsistant in that the function's supposed purpose is to create a header from the root of a provided part, but the concluding body of the current form of EnvelopeFromPart() gathering errors from any/all nested/child/sibling parts. This is an effort to clarify the scope of work of EnvelopeFromPart to focus on any single part.

Testing

All current tests pass, and because the new method GatherNestedErrors() is also called ReadEnvelope(), ReadEnvelope()'s tests cover the GatherNestedErrors().

Note:

This is me actually following through on #372 - Better late than never.

…work is more aligned to the root aspect of a provided part.

Also extracted the previous functionality into a new method on the Envelope type - GatherNestedErrors(). Also implemented GatherNestedErrors() within ReadEnvelope() after the call to EnvelopeFromPart() and added supporting test cases.
@coveralls
Copy link
Copy Markdown

coveralls commented Apr 7, 2026

Coverage Status

coverage: 86.568% (-0.01%) from 86.581% — bgedney:main into jhillyerd:main

Copy link
Copy Markdown
Owner

@jhillyerd jhillyerd left a comment

Choose a reason for hiding this comment

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

just needs a comment fix

Comment thread envelope.go Outdated
@bgedney bgedney requested a review from jhillyerd April 23, 2026 22:10
@jhillyerd jhillyerd changed the title Refactor EnvelopeFromPart()'s scope feat!: Refactor EnvelopeFromPart()'s scope Apr 29, 2026
@jhillyerd jhillyerd merged commit 06ccb85 into jhillyerd:main Apr 29, 2026
9 checks passed
@jhillyerd
Copy link
Copy Markdown
Owner

Thanks!

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.

3 participants