Skip to content

Extend Rake with a more elegant and reliable way#1517

Merged
st0012 merged 2 commits intogetsentry:masterfrom
knapo:extend-rake-in-a-more-elegant-way
Jul 29, 2021
Merged

Extend Rake with a more elegant and reliable way#1517
st0012 merged 2 commits intogetsentry:masterfrom
knapo:extend-rake-in-a-more-elegant-way

Conversation

@knapo
Copy link
Copy Markdown
Contributor

@knapo knapo commented Jul 28, 2021

Extend Rake with a more elegant and reliable way

Closes #1520

Description

Per 4dc603b#r54079829

Overwriting methods with aliasing is is rather a bad practice and, since it may cause conflicts, circular dependencies and infinite loops. Module#prepend is more elegant and reliable.

@st0012
Copy link
Copy Markdown
Contributor

st0012 commented Jul 28, 2021

As I mentioned in 4dc603b#r54080150, using prepend doesn't guarantee conflict-free.

in fact, I used prepend over alias when patching Net::HTTP. but the conflicts aren't that few, you can see #1427 for more detail.

I choose alias for the rake integration because display_error_message was patched this way since the sentry-raven era and it seemed to work fine. so I didn't want to change it and potentially introduce another set of conflicts.

Can you tell me what caused the conflicts in your application?

@knapo
Copy link
Copy Markdown
Contributor Author

knapo commented Jul 29, 2021

@st0012

Can you tell me what caused the conflicts in your application?

My other gem extends Rake::Task with prepend, what doesn't cooperates with aliasing and getting a stack level too deep (SystemStackError). It's basically same case as in the example I shared .

@st0012 st0012 self-assigned this Jul 29, 2021
@st0012 st0012 added this to the 4.7.0 milestone Jul 29, 2021
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 29, 2021

Codecov Report

❌ Patch coverage is 50.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.75%. Comparing base (8387282) to head (040ed70).
⚠️ Report is 848 commits behind head on master.

Files with missing lines Patch % Lines
sentry-ruby/lib/sentry/rake.rb 50.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1517      +/-   ##
==========================================
+ Coverage   98.20%   98.75%   +0.55%     
==========================================
  Files         218      123      -95     
  Lines       10607     6771    -3836     
==========================================
- Hits        10417     6687    -3730     
+ Misses        190       84     -106     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@st0012 st0012 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix 👍

@st0012 st0012 merged commit 9901068 into getsentry:master Jul 29, 2021
@knapo knapo deleted the extend-rake-in-a-more-elegant-way branch July 29, 2021 12:48
@st0012 st0012 modified the milestones: 4.7.0, 4.6.4 Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stack level too deep (SystemStackError) after upgrading from 4.6.1 to 4.6.2

3 participants