Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
- We have several files within our theme codebase that needs to adhere to a set of coding standards defined by the community.
- We need to adjust the way we style and format our Twig files to include appropriate indentation, whitespace, commenting, line length, etc. Ensuring that all code adheres to the same style gives the Olivero project a sense of coherence and makes it easier for all of us to read each other's code.
phpcs result on twig files
vendor/bin/phpcs --standard=Drupal --extensions=twig themes/olivero/templates/
FILE: /var/www/html/D-9.1.x-git/themes/olivero/templates/block/block--secondary-menu.html.twig
----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------
56 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------------------------------
FILE: /var/www/html/D-9.1.x-git/themes/olivero/templates/block/block--primary-menu--search-form-block.html.twig
---------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------
48 | ERROR | [x] Expected 1 newline at end of file; 0 found
---------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------------------------------------------
Time: 80ms; Memory: 8MB
Remaining tasks
- Analyze Olivero's Twig files using Coder, as seen on #3155547: Coding standards issue in theme file
- Confirm that the changes meet Drupal's Twig coding standards.
Comment | File | Size | Author |
---|---|---|---|
#5 | 3156210-5.patch | 801 bytes | nitesh624 |
Comments
Comment #2
nitesh624Comment #3
nitesh624Updating the issue summary
Comment #4
nitesh624Comment #5
nitesh624Comment #6
nitesh624Comment #7
himanshu_sindhwani CreditAttribution: himanshu_sindhwani at Srijan | A Material+ Company for Drupal India Association commentedThis issue is not reproducible on the latest HEAD.
Comment #8
steinmb CreditAttribution: steinmb as a volunteer commentedThank you for working on coding standards @nitesh624. Updating issue to latest dev. Did something go into repo. between patch and test? Care to run code sniffer one more time?
Comment #9
nitesh624Comment #10
nitesh624Stilll i can see the coding standard error please see below.
Comment #11
nitesh624Comment #12
steinmb CreditAttribution: steinmb as a volunteer commentedComment #14
mherchelCommitting. Thanks!