Skip to content
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

When using the curlylint linter in Django templates it generates a false positive parse error #127

Closed
brammittendorff opened this issue Mar 15, 2022 · 1 comment
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@brammittendorff
Copy link

brammittendorff commented Mar 15, 2022

Describe the bug

When using the following template code in Django templates:

templates/test.html

<input type="{{ field.field.widget.input_type }}" {% for key, value in field.field.widget.attrs.items %}{{ key }}="{{ value }}" {% endfor %}>

or

<input type="{{ field.field.widget.input_type }}" {% for key, value in field.field.widget.attrs.items %} {{ key }}="{{ value }}" {% endfor %}>

It gives a parse error:

❯ curlylint ~/templates/test.html
~/templates/test.html
0:114   Parse error: expected one of '/', '>', 'attribute', 'space(s) between attributes', '{#', '{%', '{{' at 0:114    parse_error

Oh no! 💥 💔 💥
1 error reported

Which terms did you search for in the documentation and issue tracker?

I searched for in the issue tracker for:

Django error
Django parse_error

But i couldn't find the same kind of issue.

Environment

Version

❯ curlylint --version
curlylint, version 0.13.0

OS

Windows 10

And also:

Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.3 LTS
Release:	20.04
Codename:	focal

Steps to reproduce

(Write your steps here:)

  1. Create a test.html file with the following contents:
<input type="{{ field.field.widget.input_type }}" {% for key, value in field.field.widget.attrs.items %} {{ key }}="{{ value }}" {% endfor %}>
  1. Then run curlylint
curlylint test.html

Expected behavior

It shouldn't complain about a parse_error because this is regular Django template language.

Actual behavior

It gives a parse_error:

❯ curlylint test.html
test.html
0:114   Parse error: expected one of '/', '>', 'attribute', 'space(s) between attributes', '{#', '{%', '{{' at 0:114    parse_error

Oh no! 💥 💔 💥
1 error reported
@brammittendorff brammittendorff added the bug Something isn't working label Mar 15, 2022
@thibaudcolas
Copy link
Owner

Hi @brammittendorff, thank you for taking the time to report this with so many details! I believe this is the same issue as #23, so I’ll close in favour of that older entry.

@thibaudcolas thibaudcolas added the duplicate This issue or pull request already exists label Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants