Like what Core is planning to do: #3284817: Adopt vincentlanglet/twig-cs-fixer for Twig coding standards
Our templates are already 99% compliant, the main nicety is the removal of quote in mapping keys:
- {{ 'Replaces'|t }}: <a href="{{ url('ui_patterns_library.single', {'provider': component.replaces|split(':') |first, 'machineName': component.replaces|split(':')|last }) }}">{{ component.replaces }}</a>
+ {{ 'Replaces'|t }}: <a href="{{ url('ui_patterns_library.single', {provider: component.replaces|split(':')|first, machineName: component.replaces|split(':')|last}) }}">{{ component.replaces }}</a>
We need to do 2 tasks:
- run the twig linter on existign codebase
- add the linter to our CI pipeline
Issue fork ui_patterns-3483831
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
pdureau commentedDone in beta5: https://git.drupalcode.org/project/ui_patterns/-/commit/427b83660dffb549...
Moved to RC scope, and it will be the opportunity to run the command again.
Comment #4
smovs commentedComment #5
pdureau commentedComment #7
smovs commentedHi guys!
I added the twig linter to the CI pipeline.
Please review.
Comment #8
pdureau commentedHi smos,
Christian will review your gitlab CI addition.
It seems you didn't run the linter on the existing UIP2 codebase, because I have this:
Comment #9
smovs commentedHi pdureau,
Thank you for your feedback.
Indeed, I didn't run the linter when finished with GitLab CI. I will check it.
Comment #10
just_like_good_vibesone comment about the "with_context=false".
I knew the linter wanted to put "with_context: false", but it is written everywhere that the right code portion is "with_context=false".
so i was like confused.
what do you guys think?
Comment #11
smovs commentedI was also a bit confused and double-checked it on the Twig CS page. They suggest use
:instead of=Anyway, we can use our custom ruleset to override if necessary.
Twig CS here: Link to CS
Comment #12
christian.wiedemann commentedI checked it right now, and it is fine for me. We use "only" . (Is it the same)
Comment #13
pdureau commentedNo custom ruleset. Let's just follow default vincentlanglet/twig-cs-fixer without overthinking
Comment #15
pdureau commented