-
Notifications
You must be signed in to change notification settings - Fork 25
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
add new rule django_block_translate_trimmed #137
base: main
Are you sure you want to change the base?
add new rule django_block_translate_trimmed #137
Conversation
b13c1b5
to
f7e7d76
Compare
Updated with a few more tests, not sure if I need to test malformed (e.g. unclosed) block tags. |
curlylint/rules/django_block_translate_trimmed/django_block_translate_trimmed_test.json
Outdated
Show resolved
Hide resolved
f7e7d76
to
d8be7a2
Compare
("blocktrans", "plural", "endblocktrans"), | ||
("block", "endblock"), |
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.
note: this re-order is required because the approach is greedy, the first match is used.
So if we want to ensure that blocktranslate
gets pulled in and it does not get treated as blocktrans
or block
we need to ensure that it is first.
Hope that makes sense.
Also blocktranslate is the Django 4.0 variant.
d8be7a2
to
dce3e2d
Compare
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.
Nice work 👍
Thinking of other potential test cases:
trimmed
is not the first argument to theblocktranslate
tag when using multiple arguments- there are linebreaks between the open/close tags (but maybe this is something which is tested elsewhere in curlylint and do not need to be tested specifically here).
Loic - good call about the @loicteixeira @zerolab is there anything else blocking this PR? |
Nothing from me. Nice work @lb-! |
- the rule will enforce the usage of `trimmed` when blocktranslate or blocktrans is in use
dce3e2d
to
47eb4ef
Compare
Tests updated to include scenarios listed above, just need someone to trigger the workflow. I was getting this error locally but it does not not seem to be related to the changes I have made.
|
trimmed
when blocktranslate or blocktrans is in useI had trouble running
black
, not sure if it is a config issue but no matter what I would put into Python files, black would not do anything so I just copy/pasted from the Black playground and back into the editor.Additional items
trimmed
is not the first argument to the blocktranslate tag when using multiple arguments