From 1d158a9e3821bd85842dcc3bb2e26ea19a8e4af7 Mon Sep 17 00:00:00 2001 From: Fabrice Gangler <fabrice.gangler@adullact.org> Date: Fri, 19 Jul 2024 12:37:27 +0200 Subject: [PATCH] ci: add Twig template linter --- .gitlab/ci/job.php.gitlab-ci.yml | 21 +++++++++++++++++++++ Makefile | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/.gitlab/ci/job.php.gitlab-ci.yml b/.gitlab/ci/job.php.gitlab-ci.yml index 762b588..ee0ff62 100644 --- a/.gitlab/ci/job.php.gitlab-ci.yml +++ b/.gitlab/ci/job.php.gitlab-ci.yml @@ -191,6 +191,27 @@ php8.1_tests_mutation: - make tests_mutation # - ../../bin/infection --show-mutations --min-covered-msi=20 --min-msi=65 + +####################################################################### +# TWIG Linter https://symfony.com/doc/current/templates.html#linting-twig-templates +# --> a CI job that will lint all .twig files +####################################################################### +twig_linter: + extends: + - .php8.1_template + needs: [] + rules: + - if: $CI_PIPELINE_SOURCE == "push" +# when: manual +# allow_failure: true + before_script: + - cd "${PHP_WEBAPP_DIR}" + - composer install --no-progress --no-suggest --no-interaction --no-scripts + script: + - cd "${CI_PROJECT_DIR}" + - make twig_linter + + ####################################################################### # PHP-Linter https://github.com/php-parallel-lint/PHP-Parallel-Lint # --> a CI job that will lint all .php files diff --git a/Makefile b/Makefile index afe29ab..3d1d857 100644 --- a/Makefile +++ b/Makefile @@ -132,6 +132,11 @@ sf_fix-coding-standard: ## ... bin/php-cs-fixer fix -vvv --diff webapp/tests/ .PHONY: sf_fix-coding-standard + +twig_linter: ## Twig templates linter + webapp/bin/console lint:twig --show-deprecations webapp/templates/ +.PHONY: php_coding-standard + php_coding-standard: ## ... bin/phpcs --standard=PSR12 --colors webapp/src/ webapp/tests/ -s .PHONY: php_coding-standard -- GitLab