From 2d8927af40cb3131496876e08bab63f63d2a39d8 Mon Sep 17 00:00:00 2001 From: Snoweuph Date: Mon, 19 Feb 2024 22:23:07 +0100 Subject: [PATCH] #1 [Ticket] Adding Twig CS Fixer --- app/.gitignore | 4 ++ app/.twig-cs-fixer.php | 12 ++++ app/composer.json | 3 +- app/composer.lock | 140 ++++++++++++++++++++++++++++++++++++++++- app/symfony.lock | 9 +++ 5 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 app/.twig-cs-fixer.php diff --git a/app/.gitignore b/app/.gitignore index 5591d95..8bf69ef 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -35,3 +35,7 @@ phpstan.dist.neon # Encore Daemon /npm-watch.pid + +###> vincentlanglet/twig-cs-fixer ### +/.twig-cs-fixer.cache +###< vincentlanglet/twig-cs-fixer ### diff --git a/app/.twig-cs-fixer.php b/app/.twig-cs-fixer.php new file mode 100644 index 0000000..d0fd4ae --- /dev/null +++ b/app/.twig-cs-fixer.php @@ -0,0 +1,12 @@ +addStandard(new TwigCsFixer\Standard\Twig()); +$ruleset->addRule(new TwigCsFixer\Rules\Whitespace\EmptyLinesRule()); +$ruleset->addRule(new TwigCsFixer\Rules\Variable\VariableNameRule(TwigCsFixer\Rules\Variable\VariableNameRule::CAMEL_CASE)); + +$config = new TwigCsFixer\Config\Config(); +$config->setRuleset($ruleset); +$config->allowNonFixableRules(); + +return $config; \ No newline at end of file diff --git a/app/composer.json b/app/composer.json index b2928e1..585eb98 100644 --- a/app/composer.json +++ b/app/composer.json @@ -88,6 +88,7 @@ "symfony/css-selector": "6.3.*", "symfony/debug-bundle": "6.3.*", "symfony/phpunit-bridge": "^7.0", - "symfony/web-profiler-bundle": "6.3.*" + "symfony/web-profiler-bundle": "6.3.*", + "vincentlanglet/twig-cs-fixer": "^2.4" } } diff --git a/app/composer.lock b/app/composer.lock index 8ce8541..fbac85d 100644 --- a/app/composer.lock +++ b/app/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "da2d735419ac40bad64d8d4693a99044", + "content-hash": "2570c00daac6d35734750c2b68354551", "packages": [ { "name": "doctrine/cache", @@ -8212,6 +8212,144 @@ } ], "time": "2023-11-20T00:12:19+00:00" + }, + { + "name": "vincentlanglet/twig-cs-fixer", + "version": "2.4.4", + "source": { + "type": "git", + "url": "https://github.com/VincentLanglet/Twig-CS-Fixer.git", + "reference": "f9e76645b81df65d64d09d88ce05eaae34def8b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/VincentLanglet/Twig-CS-Fixer/zipball/f9e76645b81df65d64d09d88ce05eaae34def8b6", + "reference": "f9e76645b81df65d64d09d88ce05eaae34def8b6", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2.0.0", + "ext-ctype": "*", + "ext-json": "*", + "php": ">=8.0", + "symfony/console": "^5.4.9 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/string": "^5.4 || ^6.0 || ^7.0", + "twig/twig": "^2.14.0 || ^3.0.5", + "webmozart/assert": "^1.10" + }, + "require-dev": { + "dereuromark/composer-prefer-lowest": "^0.1.10", + "ergebnis/composer-normalize": "^2.29", + "friendsofphp/php-cs-fixer": "^3.13.0", + "icanhazstring/composer-unused": "^0.8.5", + "infection/infection": "^0.26.16 || ^0.27.0", + "maglnet/composer-require-checker": "^3.8 || ^4.3", + "phpstan/phpstan": "^1.9.1", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpstan/phpstan-symfony": "^1.2.16", + "phpstan/phpstan-webmozart-assert": "^1.2.2", + "phpunit/phpunit": "^9.5.26 || ^10.0.9", + "psalm/plugin-phpunit": "^0.18.4", + "psalm/plugin-symfony": "^5.0.0", + "rector/rector": "^1.0.0", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/twig-bridge": "^5.4 || ^6.0 || ^7.0", + "symfony/ux-twig-component": "^2.2.0", + "twig/cache-extra": "^3.2", + "vimeo/psalm": "^5.2.0" + }, + "bin": [ + "bin/twig-cs-fixer" + ], + "type": "coding-standard", + "autoload": { + "psr-4": { + "TwigCsFixer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Vincent Langlet" + } + ], + "description": "A tool to automatically fix Twig code style", + "homepage": "https://github.com/VincentLanglet/Twig-CS-Fixer", + "support": { + "issues": "https://github.com/VincentLanglet/Twig-CS-Fixer/issues", + "source": "https://github.com/VincentLanglet/Twig-CS-Fixer/tree/2.4.4" + }, + "funding": [ + { + "url": "https://github.com/VincentLanglet", + "type": "github" + } + ], + "time": "2024-02-19T10:17:09+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "php": "^7.2 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.13" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.11.0" + }, + "time": "2022-06-03T18:03:27+00:00" } ], "aliases": [], diff --git a/app/symfony.lock b/app/symfony.lock index 30d7edb..629e7d6 100644 --- a/app/symfony.lock +++ b/app/symfony.lock @@ -253,5 +253,14 @@ }, "twig/extra-bundle": { "version": "v3.7.1" + }, + "vincentlanglet/twig-cs-fixer": { + "version": "2.4", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "0.6", + "ref": "e4da12a48e8138479bd24a675321bcfd84950266" + } } }