[1.0.0] Adopt vincentlanglet/twig-cs-fixer for Twig coding standards

Created on 4 July 2024, 6 months ago
Updated 6 July 2024, 5 months ago

Problem/Motivation

Drupal Core is planning to 📌 Adopt friendsoftwig/twigcs for Twig coding standards Needs review

Let's do the same in our codebase.

Proposed resolution

Before tagging 1.0.0, run vendor/bin/twig-cs-fixer lint --fix /path/to/code a first time.

Do we also need to add something somewhere (README, Makefile...)?

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇫🇷France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @pdureau
  • 🇫🇷France pdureau Paris

    Good opportunity to do those little Twig fixes too.

    footer

    Use `|default(foo)` filter instead of shorthand ternary `?:`

    <a class="fr-footer__brand-link" href="{{ home_url|default('/') }}" title="{{ 'Homepage'|t }} - {{ operator_logo_alt ? operator_logo_alt : service_title }} - {{ logo_text }}">

    translate

    Unused variables: html_id

    Function `random()` must be used in a `default()` filter!

    nav_menu

    Function `random()` must be used in a `default()` filter!

    {% set item_id = 'menu-'~loop.index~'-'~random() %}
    {% set item_id = 'mega-menu-'~loop.index~'-'~random() %}
    • pdureau committed 2da48f67 on 1.0.x
      Issue #3458956 by pdureau: Adopt vincentlanglet/twig-cs-fixer for Twig...
  • Status changed to Fixed 6 months ago
  • Status changed to Fixed 5 months ago
Production build 0.71.5 2024