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

[Beta - Bug] Rule twig statement #128

Closed
Yivan opened this issue Feb 18, 2020 · 3 comments
Closed

[Beta - Bug] Rule twig statement #128

Yivan opened this issue Feb 18, 2020 · 3 comments

Comments

@Yivan
Copy link

Yivan commented Feb 18, 2020

Hello,

I just try the latest beta at this day, and i got for:

{{
pimcore_renderlet('newsteaser', {
type: 'object',
editmode: editmode,
controller: 'News',
action: 'emailNewsTeaser',
title: 'Drag a news object here',
height : '400px',
width: '100%'
})
}}

the message: ERROR A print statement should start with 1 space.

I think twigcs want inlined {{ pimcore_renderlet('newsteaser', {...

But as it the code seems to respect the standart twig rules. Maybe cariage return should be count like a space...

For information, i test the linting on this: https://github.com/pimcore/demo/tree/master/app/Resources/views

Thanks!

@Yivan
Copy link
Author

Yivan commented Feb 18, 2020

By the way i found the same problem on this code:

<thead>
    {%
        include 'Areas/print-product-table/spec_attribute/column-attribute-table-header.html.twig' with {
            'configArray': configArray,
            'classname': classname,
            'levels': levels,
            'currentLevel': 0
        }
    %}
</thead>

which return ERROR A tag statement should start with 1 space.
It seems always that carriage return are not acocunted like space, but should i think.


I think more globally, cariage return should be counted like a space. Twig standard rules don't forbid this, and it results in clearer code. The way twigcs seems to act dissallow any multine blocks without the code following directly after on the same line.
But what should be checked is indentation is ok i think (opening and closing brakets/tags).

@OwlyCode
Copy link
Collaborator

Hey,

I do not see any problem. Here's what those examples should look like for twigcs to pass:

<thead>
    {% include 'Areas/print-product-table/spec_attribute/column-attribute-table-header.html.twig' with {
        'configArray': configArray,
        'classname': classname,
        'levels': levels,
        'currentLevel': 0
    } %}
</thead>

{{ pimcore_renderlet('newsteaser', {
    type: 'object',
    editmode: editmode,
    controller: 'News',
    action: 'emailNewsTeaser',
    title: 'Drag a news object here',
    height: '400px',
    width: '100%'
}) }}

It seems to me this is related to #58

@Yivan
Copy link
Author

Yivan commented Feb 18, 2020

Thanks, yes exactly, it is same than #58
After reading more carefully twig standard norm, yes you are right Put one (and only one) space after the start of a delimiter ({{, {%, and {#) and before the end of a delimiter (}}, %}, and #}):
My bads, this issue can be close so!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants