- Issue created by @longwave
Drupal core is moving towards using a โmainโ branch. As an interim step, a new 11.x branch has been opened โ , as Drupal.org infrastructure cannot currently fully support a branch named
main
. New developments and disruptive changes should now be targeted for the11.x
branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule โ and the Allowed changes during the Drupal core release cycle โ .Drupal 9.5.0-beta2 โ and Drupal 10.0.0-beta2 โ were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule โ and the Allowed changes during the Drupal core release cycle โ .
- First commit to issue fork.
- Status changed to Needs review
about 1 year ago 11:38pm 3 November 2023 - ๐ต๐นPortugal saidatom Lisbon
Twig Coding Standard (twig-cs-fixer) found 120 errors, check attachment.
- Status changed to Needs work
about 1 year ago 1:27pm 10 November 2023 The Needs Review Queue Bot โ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide โ to find step-by-step guides for working with issues.
- Status changed to Needs review
about 1 year ago 1:43pm 10 November 2023 - Status changed to Needs work
about 1 year ago 12:22pm 11 November 2023 The Needs Review Queue Bot โ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide โ to find step-by-step guides for working with issues.
- ๐ต๐ฑPoland wotnak
MR !5248 adds vincentlanglet/twig-cs-fixer instead of friendsoftwig/twigcs about which is this issue.
That being said, friendsoftwig/twigcs maintainer is looking for someone to take over the maintainership and considers putting the project in the EOL status if no one will step up.
https://github.com/friendsoftwig/twigcs/issues/304One alternative they point to is vincentlanglet/twig-cs-fixer (which MR !5248 adds).
Personally, I also prefer vincentlanglet/twig-cs-fixer since it also includes automatic fixes. We already using it for some time at work in Drupal based projects, and it works great. - ๐ฆ๐บAustralia alex.skrypnyk Melbourne
Looks like `friendsoftwig/twigcs` will be EOL soon and `vincentlanglet/twig-cs-fixer` is a promising replacement.
Should we change the title and description to be more generic?
- ๐ช๐ธSpain rodrigoaguilera Barcelona
Yes, vincentlanglet/twig-cs-fixer is a tool with more adoption, more maintained and is more aligned with drupal releases in aspects like phpstan and following symfony releases.
I don't see the failure in the current PR but anyway it needs a rebase.
- Status changed to Needs review
6 months ago 7:49am 19 June 2024 - Status changed to Needs work
5 months ago 12:00pm 5 July 2024 The Needs Review Queue Bot โ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide โ to find step-by-step guides for working with issues.
- Status changed to Needs review
5 months ago 12:36pm 10 July 2024 - Status changed to Needs work
5 months ago 12:02pm 11 July 2024 The Needs Review Queue Bot โ tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide โ to find step-by-step guides for working with issues.
- ๐บ๐ธUnited States xjm
#2 is still not addressed; this issue could be a whole lot of wasted effort if the dependency doesn't pass the dependency evaluation. I recommend ceasing rerolling/rebasing/etc. and instead completing the dependency evaluation, then tagging it "Needs release manager review" and "Needs frontend framework manager review".
- ๐บ๐ธUnited States xjm
Also things with lockfile changes are never good candidates for the friendly bot as they break constantly, and it's not worth rerolling something forever without other progress. So tagging so the bot leaves it alone. Thanks!
- ๐ฉ๐ชGermany Feuerwagen Bonn ๐ฉ๐ช๐ช๐บ
Took an initial stab at the dependency evaluation. Only thing that seems to be missing is the security policy โ opened https://github.com/VincentLanglet/Twig-CS-Fixer/issues/255
- Status changed to Needs review
5 months ago 12:00pm 12 July 2024 - ๐บ๐ธUnited States xjm
Very nice work @Feuerwagen! Setting NR for review.
- ๐ฌ๐งUnited Kingdom longwave UK
Thanks @Feuerwagen, as the maintainer is very responsive let's wait a few days for the security policy to hopefully be adopted and then we can move forward here.
Also fixing obsolete link in the IS.
- ๐ฉ๐ชGermany Feuerwagen Bonn ๐ฉ๐ช๐ช๐บ
My security policy proposal got adopted, see https://github.com/VincentLanglet/Twig-CS-Fixer/security/policy
- Status changed to RTBC
4 months ago 3:28pm 14 August 2024 - ๐บ๐ธUnited States smustgrave
Personally think the evaluation contains all good information.
Think this would be a welcome addition, have a current project I'm scared how much will get flagged.
I'm marking RTBC to get in front of the various managers :)
- ๐บ๐ธUnited States papagrande US West Coast
+1 for this.
I've started using this on a client site and had to customize it a bit for Drupal:
For spacing:
$ruleset->overrideRule(new TwigCsFixer\Rules\Whitespace\IndentRule( spaceRatio : 2, useTab : FALSE, ));
And for now I've had to exclude templates that use{% trans %}
because it isn't defined in the default rules, and I couldn't get the ignore next line comments to work. - Status changed to Needs work
4 months ago 10:47am 15 August 2024 - ๐ฌ๐งUnited Kingdom longwave UK
Evaluation looks good to me and as release manager I have no issues with adding this as a dev dependency.
However the MR currently has merge conflicts and also the package is added as a non-dev dependency so that needs to be fixed.
- Status changed to Needs review
4 months ago 8:06am 19 August 2024 - Status changed to RTBC
4 months ago 9:05am 19 August 2024 - ๐ฉ๐ชGermany Feuerwagen Bonn ๐ฉ๐ช๐ช๐บ
Conflicts are resolved, tests are passing, twig-cs-fixer is moved to require-dev. Seems like everything is addressed.
- Status changed to Needs review
3 months ago 10:18pm 20 August 2024 - ๐บ๐ธUnited States lhridley
Per https://www.drupal.org/project/drupal/issues/3284817#comment-15729173 ๐ Adopt friendsoftwig/twigcs for Twig coding standards Needs review , I have had the same issue with templates that utilize {% trans %} tags as well.
* The Symfony Twig documentation indicates that the proper syntax to use is
</code>. This syntax validates. * <a href="https://www.drupal.org/node/2047135">Drupal's documentation</a> indicates that the syntax to use for the {% trans %} tags is <code>{% trans %} Submitted by {{ author.name }} on {{ node.date }} {% endtrans %}
, which does not validate.
Which is correct?
If it is the former, before we adopt this we should correct our documentation, and IMO this is worth noting in the release notes.
- ๐ฌ๐งUnited Kingdom longwave UK
TwigNodeTrans::compileString()
callstrim()
on the supplied text:return [ new Node([new ConstantExpression(trim($text), $body->getTemplateLine())]), $tokens, ];
This means that whitespace either side of the text inside the tags is removed, so it doesn't matter which syntax we use.
- Status changed to RTBC
3 months ago 9:13pm 31 August 2024 - ๐บ๐ธUnited States thejimbirch Cape Cod, Massachusetts
I am also getting
Error: Tag "trans" is already registered. Failed to execute command vendor/bin/twig-cs-fixer lint --fix docroot/modules/custom --debug: exit status 2
- ๐ฆ๐บAustralia alex.skrypnyk Melbourne
@thejimbirch
could you please provide more information on when and how you got that error.I just tested on TwigCSFixer 3.0.1, 3.0.3, 3.1.0 on D11.0.4 with and without
$config->addTokenParser(new Drupal\Core\Template\TwigTransTokenParser());
on the following code{% trans %} Submitted by {{ author.name }} on {{ node.date }} {% endtrans %} {% trans %}Submitted by %author.name% on %node.date%{% endtrans %}
and it passed in all cases without issues.
- ๐บ๐ธUnited States papagrande US West Coast
@alex.skrypnyk, thanks for your testing. Since #27 when I had v2 installed, I've updated to v3 and retested. Now all the lines with
trans
pass. I can remove the folder exclusions that I had as a temporary workaround. - ๐ซ๐ทFrance nod_ Lille
+1 on linting twig files and on the specific tool considered.
Merge conflict in the MR + a few comments.