Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

3/6: Fix generating sigs for mailer with default value #293

Merged
merged 3 commits into from Mar 12, 2020

Conversation

hdoan741
Copy link
Contributor

@hdoan741 hdoan741 commented Mar 7, 2020

Whelp, I did it. I spent some time figuring out how to parse ruby source code and extract default value for parameters!

I wasted quite a lot of time trying to parse the method signature myself, and learned that it's possible to use Regex for finding matching parenthesis! It's fascinating See: https://stackoverflow.com/questions/546433/regular-expression-to-match-balanced-parentheses#

However, the easier thing to do is using a ruby parser to do this. parser is a really nice library. I also steal some code from parlour's type parser to render a node as string easily.

The end result: we can parse the default value of optional args and optional keyword args! It's beautiful!

@codecov-io
Copy link

Codecov Report

Merging #293 into master will decrease coverage by 0.07%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #293      +/-   ##
==========================================
- Coverage   96.79%   96.71%   -0.08%     
==========================================
  Files         142      142              
  Lines        2524     2585      +61     
==========================================
+ Hits         2443     2500      +57     
- Misses         81       85       +4
Impacted Files Coverage Δ
...pec/support/v6.0/app/mailers/application_mailer.rb 100% <ø> (ø) ⬆️
...ort/v5.0/app/mailers/hogwarts_acceptance_mailer.rb 100% <100%> (ø) ⬆️
spec/sorbet_utils_spec.rb 100% <100%> (ø) ⬆️
...ort/v6.0/app/mailers/hogwarts_acceptance_mailer.rb 100% <100%> (ø) ⬆️
...ort/v5.2/app/mailers/hogwarts_acceptance_mailer.rb 100% <100%> (ø) ⬆️
...ort/v5.1/app/mailers/hogwarts_acceptance_mailer.rb 100% <100%> (ø) ⬆️
lib/sorbet-rails/sorbet_utils.rb 93.75% <91.37%> (-3.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f10e5c8...1b18327. Read the comment docs.

@mahmoudian1
Copy link

mahmoudian1 commented Mar 7, 2020

Codecov Report

Merging #293 into master will decrease coverage by 0.07%.
The diff coverage is 94.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #293      +/-   ##
==========================================
- Coverage   96.79%   96.71%   -0.08%     
==========================================
  Files         142      142              
  Lines        2524     2585      +61     
==========================================
+ Hits         2443     2500      +57     
- Misses         81       85       +4     

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f10e5c8...1b18327. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Mar 12, 2020

Codecov Report

Merging #293 into master will decrease coverage by 0.07%.
The diff coverage is 94.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #293      +/-   ##
==========================================
- Coverage   96.84%   96.76%   -0.08%     
==========================================
  Files         142      142              
  Lines        2532     2598      +66     
==========================================
+ Hits         2452     2514      +62     
- Misses         80       84       +4     
Impacted Files Coverage Δ
...pec/support/v6.0/app/mailers/application_mailer.rb 100.00% <ø> (ø)
lib/sorbet-rails/sorbet_utils.rb 94.11% <92.06%> (-3.61%) ⬇️
spec/sorbet_utils_spec.rb 100.00% <100.00%> (ø)
...ort/v5.0/app/mailers/hogwarts_acceptance_mailer.rb 100.00% <100.00%> (ø)
...ort/v5.1/app/mailers/hogwarts_acceptance_mailer.rb 100.00% <100.00%> (ø)
...ort/v5.2/app/mailers/hogwarts_acceptance_mailer.rb 100.00% <100.00%> (ø)
...ort/v6.0/app/mailers/hogwarts_acceptance_mailer.rb 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 23d8914...f9e7520. Read the comment docs.

@hdoan741 hdoan741 merged commit b4a9194 into master Mar 12, 2020
@hdoan741 hdoan741 deleted the fix_mailer_generate_sig branch March 17, 2020 01:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants