-
Notifications
You must be signed in to change notification settings - Fork 21
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
preserve trailing whitespace when bumping sigil #428
preserve trailing whitespace when bumping sigil #428
Conversation
Hey @jakebrady5, You'll need to fix sign the CLA: https://github.com/Shopify/spoom/actions/runs/5754767186/job/15600749537?pr=428 Thanks! |
Yep, running it by our team quickly to see whether they prefer I proceed as corporate or individual. I'll get one of the options sorted soon. Thanks for the ping! |
lib/spoom/sorbet/sigils.rb
Outdated
@@ -28,7 +28,7 @@ module Sigils | |||
T::Array[String], | |||
) | |||
|
|||
SIGIL_REGEXP = T.let(/^#[\ t]*typed[\ t]*:[ \t]*(\w*)[ \t]*/, Regexp) | |||
SIGIL_REGEXP = T.let(/^#[\ t]*typed[\ t]*:[ \t]*(\S*)/, Regexp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This original regexp seems of, [\ t]
would not match tabs as expected. It should be changed to [[:blank:]]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Sorbet's comment parsing also does not seem to support any whitespace between typed
and :
. What do you think about this?
/^#[[:blank:]]*typed:[[:blank:]]*(\S*)/
I have signed the CLA! |
@Morriar sorry to ping, just wondering if we can expect a release for this and your dependency change? 🙏🏼 |
closes #427
By preserving trailing whitespace we can prevent spoom from generating invalid sorbet sigils which lead to invalid spoom bumps.
This regex change also makes
Sigils#strictness_in_content
match more closely to the sigils as parsed by sorbet.Tests added in this PR fail with the previous
SIGIL_REGEXP
value as follows:test_valid_bump_with_rubocop_on_sigil
test_invalid_bump_with_rubocop_on_sigil
test_strictness_invalid_string