dotkernel / frontend

DotKernel Frontend Application. Based on Mezzio microframework using Laminas components.
https://v5.dotkernel.net
MIT License
22 stars 5 forks source link

twig code style ? #432

Closed arhimede closed 2 months ago

arhimede commented 5 months ago

https://github.com/VincentLanglet/Twig-CS-Fixer

we should investigate if we want to enforece a twig code style in phpstorm and in CI actions

bidi47 commented 2 months ago

tested locally, ran these two

complains about 'trans' extension, e.g.

no impact for phpcs or psalm

the updated files can be reviewed here https://github.com/dotkernel/frontend/compare/issue-432?expand=1

the translation feature is set to be removed or replaced in https://github.com/dotkernel/frontend/issues/445, so that's a blocker for this issue

bidi47 commented 2 months ago

investigating a way to handle extensions, to pass the tests https://github.com/VincentLanglet/Twig-CS-Fixer/blob/main/docs/configuration.md#token-parsers--more

bidi47 commented 2 months ago
alexmerlin commented 2 months ago
bidi47 commented 2 months ago
  • must .twig-cs-fixer.php be stored in the root of the project?

the config file location is relevant for where you run the check from the alternative (if we want to move it) is to run the command with the config path vendor/bin/twig-cs-fixer lint --config=dir/.twig-cs-fixer.php /path/to/code where would be a better place for it?

* `.twig-cs-fixer.cache` should be gitignored?

i'll add this to the list

alexmerlin commented 2 months ago

the config file location is relevant for where you run the check from the alternative (if we want to move it) is to run the command with the config path vendor/bin/twig-cs-fixer lint --config=dir/.twig-cs-fixer.php /path/to/code where would be a better place for it?

So .twig-cs-fixer.php is a config file. Then it should be stored in the config directory. We could create a composer script (see scripts) that runs the command with --config=config/twig-cs-fixer.php appended.