ncbo / ontologies_linked_data

Models and serializers for ontologies and related artifacts backed by 4store
Other
17 stars 8 forks source link

Proposed refactor: convert notification bodies to ERB templates #197

Open jvendetti opened 2 months ago

jvendetti commented 2 months ago

I recently had to figure out why the OBO Foundry synchronization script was failing, along with the synchronization report that's supposed to go out via email at script completion. While looking at code in the Notifications class, I was bothered by the proliferation of heredocs and gsubbing. I propose using ERB templates to represent the notification bodies, and this pull request implements one example:

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 80.13%. Comparing base (604e5cb) to head (bd2ad7f).

Files Patch % Lines
lib/ontologies_linked_data/utils/notifications.rb 0.00% 8 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #197 +/- ## =========================================== + Coverage 80.07% 80.13% +0.06% =========================================== Files 65 65 Lines 5004 4999 -5 =========================================== - Hits 4007 4006 -1 + Misses 997 993 -4 ``` | [Flag](https://app.codecov.io/gh/ncbo/ontologies_linked_data/pull/197/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ncbo) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/ncbo/ontologies_linked_data/pull/197/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ncbo) | `80.13% <0.00%> (+0.06%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=ncbo#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

alexskr commented 2 months ago

great idea! This will definitely help tidy up the code.

I've noticed that some non-Rails projects store .erb files in the templates directory, though I'm uncertain if it offers any clarity over using the views directory.

jvendetti commented 2 months ago

Templates would also be a good name for the directory