Skip to content

Commit 0a906f1

Browse files
committed
[#146] Repalced TwigCS with Twig CS Fixer.
1 parent 10493ea commit 0a906f1

File tree

12 files changed

+52
-43
lines changed

12 files changed

+52
-43
lines changed

.ahoy.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ commands:
3232
vendor/bin/phpstan
3333
vendor/bin/rector --clear-cache --dry-run
3434
vendor/bin/phpmd . text phpmd.xml
35-
vendor/bin/twigcs
35+
vendor/bin/twig-cs-fixer
3636
popd >/dev/null || exit 1
3737
3838
lint-fix:
@@ -71,6 +71,14 @@ commands:
7171
vendor/bin/phpunit --testsuite functional
7272
popd >/dev/null || exit 1
7373
74+
reset:
75+
usage: Reset the project.
76+
cmd: |
77+
killall -9 php >/dev/null 2>&1 || true
78+
chmod -Rf 777 build > /dev/null
79+
rm -Rf build > /dev/null || true
80+
rm -Rf .logs > /dev/null || true
81+
7482
# Override entrypoint to alter default behaviour of Ahoy.
7583
entrypoint:
7684
- bash

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ job-test: &job-test
5252
working_directory: build
5353

5454
- run:
55-
name: Lint code with Twigcs
56-
command: vendor/bin/twigcs || [ "${CI_TWIGCS_IGNORE_FAILURE:-0}" -eq 1 ]
55+
name: Lint code with Twig CS Fixer
56+
command: vendor/bin/twig-cs-fixer || [ "${CI_TWIGCSFIXER_IGNORE_FAILURE:-0}" -eq 1 ]
5757
working_directory: build
5858

5959
- run:

.devtools/build-codebase.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ for composer_suggest in $composer_suggests; do
107107
done
108108

109109
echo "> Copy tools configuration files."
110-
cp phpcs.xml phpstan.neon phpmd.xml rector.php .twig_cs.php phpunit.xml "build/"
110+
cp phpcs.xml phpstan.neon phpmd.xml rector.php .twig-cs-fixer.php phpunit.xml "build/"
111111

112112
echo "> Symlink extension's code."
113113
rm -rf "build/web/${type}/custom" >/dev/null && mkdir -p "build/web/${type}/custom/${extension}"

.gitattributes

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Ignore files for distribution archives.
22

33
# Uncomment the lines below in your project.
4-
# .ahoy.yml export-ignore
5-
# .circleci export-ignore
6-
# .devtools export-ignore
7-
# .editorconfig export-ignore
8-
# .gitattributes export-ignore
9-
# .github export-ignore
10-
# .gitignore export-ignore
11-
# .twig_cs.php export-ignore
12-
# composer.dev.json export-ignore
13-
# phpcs.xml export-ignore
14-
# phpmd.xml export-ignore
15-
# phpstan.neon export-ignore
16-
# rector.php export-ignore
17-
# renovate.json export-ignore
18-
# tests export-ignore
4+
# .ahoy.yml export-ignore
5+
# .circleci export-ignore
6+
# .devtools export-ignore
7+
# .editorconfig export-ignore
8+
# .gitattributes export-ignore
9+
# .github export-ignore
10+
# .gitignore export-ignore
11+
# .twig-cs-fixer.php export-ignore
12+
# composer.dev.json export-ignore
13+
# phpcs.xml export-ignore
14+
# phpmd.xml export-ignore
15+
# phpstan.neon export-ignore
16+
# rector.php export-ignore
17+
# renovate.json export-ignore
18+
# tests export-ignore
1919

2020
# Remove the lines below in your project.
2121
.github/FUNDING.yml export-ignore

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ jobs:
8989
working-directory: build
9090
run: vendor/bin/phpmd . text phpmd.xml || [ "${CI_PHPMD_IGNORE_FAILURE:-0}" -eq 1 ]
9191

92-
- name: Lint code with Twigcs
92+
- name: Lint code with Twig CS Fixer
9393
working-directory: build
94-
run: vendor/bin/twigcs || [ "${CI_TWIGCS_IGNORE_FAILURE:-0}" -eq 1 ]
94+
run: vendor/bin/twig-cs-fixer || [ "${CI_TWIGCSFIXER_IGNORE_FAILURE:-0}" -eq 1 ]
9595

9696
- name: Run tests
9797
working-directory: build

.scaffold/tests/bats/_assert_init.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ assert_workflow() {
129129
vendor/bin/phpstan
130130
vendor/bin/rector --clear-cache --dry-run
131131
vendor/bin/phpmd . text phpmd.xml
132-
vendor/bin/twigcs
132+
vendor/bin/twig-cs-fixer
133133

134134
popd >/dev/null || exit 1
135135

.twig-cs-fixer.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
$ruleset = new TwigCsFixer\Ruleset\Ruleset();
6+
$ruleset->addStandard(new TwigCsFixer\Standard\Twig());
7+
8+
$finder = new TwigCsFixer\File\Finder();
9+
$finder->in(__DIR__ . '/web/modules/custom');
10+
$finder->in(__DIR__ . '/web/themes/custom');
11+
12+
$config = new TwigCsFixer\Config\Config();
13+
$config->setRuleset($ruleset);
14+
$config->setFinder($finder);
15+
16+
return $config;

.twig_cs.php

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.dist.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ vendor/bin/phpcs
5858
vendor/bin/phpstan
5959
vendor/bin/rector --clear-cache --dry-run
6060
vendor/bin/phpmd . text phpmd.xml
61-
vendor/bin/twigcs
61+
vendor/bin/twig-cs-fixer
6262
```
6363

6464
- PHPCS config: [`phpcs.xml`](phpcs.xml)
6565
- PHPStan config: [`phpstan.neon`](phpstan.neon)
6666
- PHPMD config: [`phpmd.xml`](phpmd.xml)
6767
- Rector config: [`rector.php`](rector.php)
68-
- TwigCS config: [`.twig_cs.php`](.twig_cs.php)
68+
- Twig CS Fixer config: [`.twig-cs-fixer.php`](.twig-cs-fixer.php)
6969

7070
### Tests
7171

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ to [drupal.org](https://drupal.org).
5555
with PHPStan (including [PHPStan Drupal](https://github.com/mglaman/phpstan-drupal)).
5656
- PHP deprecated code analysis
5757
with [Drupal Rector](https://github.com/palantirnet/drupal-rector).
58-
- Twig code analysis with [TwigCS](https://github.com/friendsoftwig/twigcs).
58+
- Twig code analysis with [Twig CS Fixer](https://github.com/VincentLanglet/Twig-CS-Fixer).
5959
![Lint process](https://user-images.githubusercontent.com/378794/253732548-9403e4cc-db03-4696-b114-32517ab0a571.gif)
6060
- Drupal's Simpletest testing support - runs tests in the same way as
6161
[drupal.org](https://drupal.org)'s Drupal CI

composer.dev.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"require-dev": {
33
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
4-
"friendsoftwig/twigcs": "^6.2",
54
"jangregor/phpstan-prophecy": "^1.0",
65
"mglaman/phpstan-drupal": "^1.2",
76
"palantirnet/drupal-rector": "^0.18",
87
"phpcompatibility/php-compatibility": "^9.3",
98
"phpmd/phpmd": "^2.15",
109
"phpspec/prophecy-phpunit": "^2",
11-
"phpstan/extension-installer": "^1.3"
10+
"phpstan/extension-installer": "^1.3",
11+
"vincentlanglet/twig-cs-fixer": "^2.8"
1212
},
1313
"config": {
1414
"allow-plugins": {

init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ process_internal() {
187187
uncomment_line ".gitattributes" ".gitattributes"
188188
uncomment_line ".gitattributes" ".github"
189189
uncomment_line ".gitattributes" ".gitignore"
190-
uncomment_line ".gitattributes" ".twig_cs.php"
190+
uncomment_line ".gitattributes" ".twig-cs-fixer.php"
191191
uncomment_line ".gitattributes" "composer.dev.json"
192192
uncomment_line ".gitattributes" "phpcs.xml"
193193
uncomment_line ".gitattributes" "phpmd.xml"

0 commit comments

Comments
 (0)