-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
Remove excess spacing before multiline block #247
Conversation
If you want to take a look, I added a commit which seems to fix everything except
which is a PHP 8 specific error. Some shared thought:
Maybe it's better to just make the DelimiterSpacingRule configurable for now, and add
to other rules in order to remove the param from them (so far) and wait for feature request (?) This way we could know
Does it seem ok to you ? |
@VincentLanglet Thanks so much for helping me out! I agree with what you're saying. I just rebased the PR and made the suggested changes. Let me know what you think! |
tests/Rules/Punctuation/PunctuationSpacing/PunctuationSpacingRuleTest.php
Outdated
Show resolved
Hide resolved
Co-Authored-By: Vincent Langlet <[email protected]>
Applied the feedback! |
Pushed an updated test that now fails.. I think it should also remove the spaces. |
I wont be able to debug this before the next week since I dont have a computer ATM. |
Hi @ruudk, I don't have any real failure with
I just need to update tests/failure message. But I think the failed test you wanted is the one with only one space
Is it the issue you encounter ? If yes, I'll take a look. |
Yes, I couldn't provide a good failing test. So I think what we want is that with {%
trans with {
contactUrl: 'http://contact',
}
- %}my.key{% endtrans %}
+ %}my.key{% endtrans %} So it changes 4 spaces after to 1 space after. And then with {%
trans with {
contactUrl: 'http://contact',
- }
-
- %}my.key{% endtrans %}
+ } %}my.key{% endtrans %} It should take the 4 spaces + the 2 newlines, and convert that to 1 space. |
I think It should not immediately fail the test when one of the diffs fails. It should print the diff, then continue with showing the diff for the violations, and at the end fail it. This way, when you are trying to create a failing test, you can see the violations too. Now, I had to comment that part out, in order to see what the violations would be. |
Not really, with skipIfNewLine let untouched this code because there is a new line before the last non empty token and
It's understandable. That also mean that if you have only one space, new lines will be removed {%
trans with {
contactUrl: 'http://contact',
- }
-
- %}my.key{% endtrans %}
+ } %}my.key{% endtrans %} |
I think this is what I want with this feature. See newlines also as whitespace and enforce it regardless. I never write {%
if var == true
%} or {%
trans into 'nl'
%}my.key{%endtrans %} Am I missing something? Is this common? Also, this rule is not default enabled, so we can make this different? |
@VincentLanglet Amazing 🎉 Thank you! |
Thanks |
Fixes #245