Skip to content
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

refactor: Break up HeaderSectionWriter #499

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

giovanni-guidini
Copy link
Contributor

@giovanni-guidini giovanni-guidini commented Jun 10, 2024

As time when by the HeaderSectionWriter is now home for many warnings and details to the users,
and more are on the way.

This SectionWriter has a huge entrypoint function and it's hard to figure out the ordering of the
different lines. Also with the ability to hide project coverage it had more than 1 return value,
however there are messages that need to be written in both branches.

The changes in this commit attemp to unify the 2 branches of the HeaderSectionWriter, and breaks it up
further into HeaderPieces, with a function (or 2 😅) per HeaderPiece.

The objective is to make it easier to figure out the order of lines in the header.
AND to make it easier to change specific HeaderPieces and add more HeaderPieces.

[edit] Why am I doing this, you ask? Because I need to add yet another message to this section: codecov/engineering-team#1622
and I felt bad to add more to the mess... but maybe it would be better to not put the extra message in the Header section after all.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

As time when by the HeaderSectionWriter is now home for many warnings and details to the users,
and more are on the way.

This SectionWriter has a huge entrypoint function and it's hard to figure out the ordering of the
different lines. Also with the ability to hide project coverage it had more than 1 return value,
however there are messages that need to be written in both branches.

The changes in this commit attemp to unify the 2 branches of the HeaderSectionWriter, and breaks it up
further into HeaderPieces, with a function (or 2 😅) per HeaderPiece.

The objective is to make it easier to figure out the order of lines in the header.
AND to make it easier to change specific HeaderPieces and add more HeaderPieces.
@giovanni-guidini giovanni-guidini requested a review from a team June 10, 2024 13:31
@codecov-notifications
Copy link

codecov-notifications bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #499   +/-   ##
=======================================
  Coverage   97.26%   97.26%           
=======================================
  Files         412      412           
  Lines       34424    34449   +25     
=======================================
+ Hits        33481    33506   +25     
  Misses        943      943           
Flag Coverage Δ
integration 97.26% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.26% <100.00%> (+<0.01%) ⬆️
unit 97.26% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.42% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.54% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
.../notification/notifiers/mixins/message/__init__.py 100.00% <ø> (ø)
...s/notification/notifiers/mixins/message/helpers.py 92.24% <100.00%> (+0.24%) ⬆️
.../notification/notifiers/mixins/message/sections.py 97.22% <100.00%> (+0.19%) ⬆️

@codecov-qa
Copy link

codecov-qa bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.26%. Comparing base (fb91608) to head (db3d84b).

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #499   +/-   ##
=======================================
  Coverage   97.26%   97.26%           
=======================================
  Files         412      412           
  Lines       34424    34449   +25     
=======================================
+ Hits        33481    33506   +25     
  Misses        943      943           
Flag Coverage Δ
integration 97.26% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.26% <100.00%> (+<0.01%) ⬆️
unit 97.26% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.42% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.54% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
.../notification/notifiers/mixins/message/__init__.py 100.00% <ø> (ø)
...s/notification/notifiers/mixins/message/helpers.py 92.24% <100.00%> (+0.24%) ⬆️
.../notification/notifiers/mixins/message/sections.py 97.22% <100.00%> (+0.19%) ⬆️

Copy link

codecov-public-qa bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.26%. Comparing base (fb91608) to head (db3d84b).

✅ All tests successful. No failed tests found ☺️

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #499   +/-   ##
=======================================
  Coverage   97.26%   97.26%           
=======================================
  Files         412      412           
  Lines       34424    34449   +25     
=======================================
+ Hits        33481    33506   +25     
  Misses        943      943           
Flag Coverage Δ
integration 97.26% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.26% <100.00%> (+<0.01%) ⬆️
unit 97.26% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.42% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.54% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
.../notification/notifiers/mixins/message/__init__.py 100.00% <ø> (ø)
...s/notification/notifiers/mixins/message/helpers.py 92.24% <100.00%> (+0.24%) ⬆️
.../notification/notifiers/mixins/message/sections.py 97.22% <100.00%> (+0.19%) ⬆️

Copy link

codecov bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.29%. Comparing base (fb91608) to head (db3d84b).

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #499   +/-   ##
=======================================
  Coverage   97.28%   97.29%           
=======================================
  Files         443      443           
  Lines       35153    35178   +25     
=======================================
+ Hits        34200    34225   +25     
  Misses        953      953           
Flag Coverage Δ
integration 97.26% <100.00%> (+<0.01%) ⬆️
latest-uploader-overall 97.26% <100.00%> (+<0.01%) ⬆️
unit 97.26% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
NonTestCode 94.47% <100.00%> (+<0.01%) ⬆️
OutsideTasks 97.54% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
.../notification/notifiers/mixins/message/__init__.py 100.00% <ø> (ø)
...s/notification/notifiers/mixins/message/helpers.py 92.24% <100.00%> (+0.24%) ⬆️
.../notification/notifiers/mixins/message/sections.py 96.39% <100.00%> (+0.24%) ⬆️
Related Entrypoints
run/app.tasks.notify.Notify

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.

None yet

1 participant