add new rule django_block_translate_trimmed#137
add new rule django_block_translate_trimmed#137lb- wants to merge 1 commit intothibaudcolas:mainfrom
Conversation
b13c1b5 to
f7e7d76
Compare
|
Updated with a few more tests, not sure if I need to test malformed (e.g. unclosed) block tags. |
f7e7d76 to
d8be7a2
Compare
| ("block", "endblock"), | ||
| ("blocktranslate", "plural", "endblocktranslate"), | ||
| ("blocktrans", "plural", "endblocktrans"), | ||
| ("block", "endblock"), |
There was a problem hiding this comment.
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
loicteixeira
left a comment
There was a problem hiding this comment.
Nice work 👍
Thinking of other potential test cases:
trimmedis not the first argument to theblocktranslatetag 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. |
trimmedwhen 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
trimmedis not the first argument to the blocktranslate tag when using multiple arguments