Running phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt shows the following errors/warnings which should be fixed.

FILE: ./bamboo_twig_config/src/TwigExtension/Config.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\bamboo_twig\TwigExtension\TwigExtensionBase.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./bamboo_twig_extensions/src/TwigExtension/TwigArray.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is Twig\Extension\AbstractExtension.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./bamboo_twig_extensions/src/TwigExtension/TwigDate.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Core\Template\TwigEnvironment.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./bamboo_twig_extensions/src/TwigExtension/TwigText.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Core\Template\TwigEnvironment.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./bamboo_twig_file/src/TwigExtension/File.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is Twig\TwigFilter.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./bamboo_twig_i18n/src/TwigExtension/I18n.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\bamboo_twig\TwigExtension\TwigExtensionBase.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./bamboo_twig_loader/src/TwigExtension/Loader.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\bamboo_twig\TwigExtension\TwigExtensionBase.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./bamboo_twig_loader/src/TwigExtension/Render.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\bamboo_twig\TwigExtension\TwigExtensionBase.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./bamboo_twig_security/src/TwigExtension/Security.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\bamboo_twig\TwigExtension\TwigExtensionBase.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./bamboo_twig_token/src/TwigExtension/Token.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\bamboo_twig\TwigExtension\TwigExtensionBase.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./drupalci.yml
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 21 | ERROR | [x] Expected 1 newline at end of file; 2 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./tests/modules/bamboo_twig_test/src/Controller/TestsController.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Component\Datetime\DateTimePlus.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./tests/src/Functional/BambooTwigExtensionsI18nTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is Drupal\Component\Gettext\PoItem.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./tests/src/Functional/BambooTwigLoaderTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Core\StreamWrapper\PublicStream.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./tests/src/Functional/BambooTwigRenderTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Core\StreamWrapper\PublicStream.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./tests/src/Functional/BambooTwigTestBase.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 6 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\language\Entity\ConfigurableLanguage.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./tests/src/Kernel/Loader/EntityBlockTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 9 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Tests\bamboo_twig\Traits\BlockCreationTrait.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./tests/src/Kernel/Render/ContentBlockTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 8 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Tests\bamboo_twig\Traits\BlockCreationTrait.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ./tests/src/Kernel/Render/ImageTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 7 | ERROR | [x] Use statements should be sorted alphabetically. The
   |       |     first wrong one is
   |       |     Drupal\Core\StreamWrapper\PublicStream.
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 484ms; Memory: 10MB
CommentFileSizeAuthor
#17 3350583-17.patch66.39 KBmahtab_alam
#13 phpcs-fix-3350583.patch0 bytespray_12
Command icon 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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

urvashi_vora created an issue. See original summary.

urvashi_vora’s picture

Assigned: urvashi_vora » Unassigned
Status: Needs work » Needs review
apaderno’s picture

Priority: Normal » Minor
wengerk’s picture

Status: Needs review » Needs work

Thanks for your contrib

1. on README.md and CONTRIBUTING.md, when breaking command line please add \ to keep it usable

Exemple:

-    docker-compose exec -u www-data drupal drush site-install standard --db-url="mysql://drupal:drupal@db/drupal" --site-name=Example -y
+    docker-compose exec -u www-data drupal drush site-install standard \
+    --db-url="mysql://drupal:drupal@db/drupal" --site-name=Example -y

mukesh88 made their first commit to this issue’s fork.

mukesh88’s picture

Status: Needs work » Needs review
apaderno’s picture

Title: Fix the issues reported by PHPCS » Fix the issues reported by phpcs
Status: Needs review » Needs work
-  $ docker-compose exec drupal ./vendor/bin/phpcs ./web/modules/contrib/bamboo_twig/
+  $ docker-compose exec drupal ./vendor/bin/phpcs
+  ./web/modules/contrib/bamboo_twig/
-  $ docker-compose exec drupal phpmd ./web/modules/contrib/bamboo_twig/ text ./phpmd.xml \
-  --suffixes php,module,inc,install,test,profile,theme,css,info,txt --exclude *Test.php,*vendor/*
+  $ docker-compose exec drupal phpmd ./web/modules/contrib/bamboo_twig/
+  text ./phpmd.xml \
+  --suffixes php,module,inc,install,test,profile,theme,css,info,txt
+  --exclude *Test.php,*vendor/*
   ```

The suggestion given in comment #5 has not been followed.

mukesh88’s picture

@apaderno comment #8 code in hooks in post-commit file which it's not showing in phpcs report and comment #5 has suggested on README.md and CONTRIBUTING.md file which have fixed in merge request.

wengerk’s picture

We should look at what Devel did with a phpcsxml dist file and ignore the 80 limit chars for markdown files

https://www.drupal.org/project/devel/issues/3133703

apaderno’s picture

Yes, and use that for any coding standards issue. When users report coding standards, they should be said to use the phpcs.xml.dist file that comes with the module. If they show the output of phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,js,info,txt,md,yml,twig, they should be said those reports will not be used.

As a side note, even Drupal core uses a phpcs.xml.dist or phpcs.xml file containing their own rules.

Yashaswi18 made their first commit to this issue’s fork.

pray_12’s picture

Issue summary: View changes
FileSize
0 bytes

Fixed the issues reported by phpcs

Preethy_ray changed the visibility of the branch 3350583-fix-the-issues to hidden.

pray_12’s picture

zkhan.aamir’s picture

Hi

Patch #13 is empty

Admin@DESKTOP-252TO6V MINGW64 ~/Desktop/projects/drupal/web/modules/contrib/bamboo_twig (6.0.x)
$ curl https://www.drupal.org/files/issues/2023-11-29/phpcs-fix-3350583.patch | patch -p1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
mahtab_alam’s picture

Status: Needs work » Needs review
FileSize
66.39 KB
pray_12’s picture

Hi,
Applied the patch #17. This patch is throwing the error.

git apply -v 3350583-17.patch
3350583-17.patch:22: trailing whitespace.
- rework tests by using a custom theme "bamboo_twig" in order of overriding
3350583-17.patch:30: trailing whitespace.
- allow Render form mixed parameter types - Issue #3273960 by darrenwh,
3350583-17.patch:32: trailing whitespace.
- add `bamboo_render_entity_revision` rendering of entity revision -
3350583-17.patch:34: trailing whitespace.
- add `bamboo_load_entity_revision` loading of entity revision -
3350583-17.patch:44: trailing whitespace.
- fix deprecation
Checking patch CHANGELOG.md...
error: while searching for:
### Changed
- re-enable PHPUnit Symfony Deprecation notice
- update codebase to be compliant PHP8.2
- rework tests by using a custom theme "bamboo_twig" in order of overriding *.html.twig template for tests purpose

### Added
- add coverage of Drupal 10.1.x
- allow Render form mixed parameter types - Issue #3273960 by darrenwh, wengerk
- add `bamboo_render_entity_revision` rendering of entity revision - Issue #3254160 by dibix, wengerk
- add `bamboo_load_entity_revision` loading of entity revision - Issue #3254160 by dibix, wengerk

## [6.0.0] - 2022-11-18
### Added

error: patch failed: CHANGELOG.md:8
error: CHANGELOG.md: patch does not apply
Checking patch CONTRIBUTING.md...
Checking patch README.md...
Hunk #15 succeeded at 394 (offset 1 line).
Hunk #16 succeeded at 414 (offset 1 line).
Hunk #17 succeeded at 431 (offset 1 line).
Hunk #18 succeeded at 443 (offset 1 line).
Hunk #19 succeeded at 455 (offset 1 line).
Hunk #20 succeeded at 483 (offset 1 line).
error: while searching for:
{{ bamboo_render_image(1, 'thumbnail') }}
```

`bamboo_render_image_style(path, style, preprocess)` returns the URL string of the
specified image path or URI.

- `path` string
- `style` string

error: patch failed: README.md:437
error: README.md: patch does not apply
Checking patch drupalci.yml...
Checking patch CONTRIBUTING.md...
Checking patch README.md...
error: while searching for:
The Bamboo Twig module provides some Twig extensions with some useful functions
and filters aimed to improve the development experience.

Bamboo Twig has a lot of advantages and brings a lot of new features
to the Twig landscape of Drupal 8.
It boosts performance by using lazy loading, improves the code quality
with automated workflow. It also includes automated unit and kernel tests

error: patch failed: README.md:11
error: README.md: patch does not apply
Checking patch bamboo_twig_config/src/TwigExtension/Config.php...
Checking patch bamboo_twig_extensions/src/TwigExtension/TwigArray.php...
Checking patch bamboo_twig_extensions/src/TwigExtension/TwigDate.php...
Checking patch bamboo_twig_extensions/src/TwigExtension/TwigText.php...
Checking patch bamboo_twig_file/src/TwigExtension/File.php...
Checking patch bamboo_twig_i18n/src/TwigExtension/I18n.php...
Checking patch bamboo_twig_loader/src/TwigExtension/Loader.php...
Checking patch bamboo_twig_loader/src/TwigExtension/Render.php...
Checking patch bamboo_twig_security/src/TwigExtension/Security.php...
Checking patch bamboo_twig_token/src/TwigExtension/Token.php...
Checking patch tests/modules/bamboo_twig_test/src/Controller/TestsController.php...
Checking patch tests/src/Functional/BambooTwigExtensionsI18nTest.php...
Checking patch tests/src/Functional/BambooTwigLoaderTest.php...
Checking patch tests/src/Functional/BambooTwigRenderTest.php...
Checking patch tests/src/Functional/BambooTwigTestBase.php...

nisha_j’s picture

Status: Needs review » Needs work

Hi, the patch #17 is throwing as mentioned above so changing the status to Needs work.
Thankyou.

apaderno’s picture

Title: Fix the issues reported by phpcs » Fix the errors/warnings reported by PHP_CodeSniffer
Issue summary: View changes
apaderno’s picture

Issue summary: View changes

apaderno’s picture

Status: Needs work » Needs review

I fixed all the warnings/errors for the files the phpcs.xml.dist file committed in the project repository would check.

wengerk’s picture

Thx Apaderno ! I will take a look a it asap.

I'm concerned by the failing tests and open another issue to fix it, it's easy to fix but I currently don't have much time for open source

If you wanna help, you're welcome :)
https://www.drupal.org/project/bamboo_twig/issues/3417699

wengerk’s picture

Status: Needs review » Fixed

Many Many thanks to all of you ! Has been merged on 6.0.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.