Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI for Twig #978

Closed
wants to merge 3 commits into from
Closed

Add CI for Twig #978

wants to merge 3 commits into from

Conversation

tblivet
Copy link
Contributor

@tblivet tblivet commented Oct 29, 2024

Questions Answers
Description? Add CI check for Twig
Type? new feature
BC breaks? no
Deprecations? no
Fixed ticket? -
Sponsor company @PrestaShopCorp
How to test? Check in "Actions" and "Twig Check" if the CI is green !

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
24.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2' # Use the appropriate PHP version for your project
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the comments of an AI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's a comment from the docs I wrote, but you're right, I can remove it. 👍

@M0rgan01 M0rgan01 added this to the 7.0.0 milestone Oct 29, 2024
Comment on lines +1 to +14
{
"require-dev": {
"vincentlanglet/twig-cs-fixer": "^3.1"
},
"config": {
"platform": {
"php": "8.2"
}
},
"scripts": {
"twig": "vendor/bin/twig-cs-fixer lint \"../../views/templates\"",
"twig:fix": "vendor/bin/twig-cs-fixer fix \"../../views/templates\""
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's starting to have a lot of composer.json... We have 4 including the storybook one. We don't have a way to use the main composer, with the dependency in requires-dev?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using the main composer.json with the dependencies in require-dev, but I couldn’t get it to work because it requires a more recent PHP version. Do we have any other options?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could use docker. You must create an image, use the PHAR given by the project

Ex:

FROM php:8.2-cli

RUN wget -c https://github.com/VincentLanglet/Twig-CS-Fixer/releases/download/3.1.0/twig-cs-fixer.phar \
    -O /usr/local/bin/twig-cs-fixer

RUN chmod +x /usr/local/bin/twig-cs-fixer

ENTRYPOINT ["twig-cs-fixer"]
CMD ["twig"]

docker build -t twig-cs-fixer-image .
docker run --rm twig-cs-fixer-image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no way to have an additional tool in our existing dependency list, I would rather not try to force its inclusion in the project because it would create one more way to run a specific binary. :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I close this PR !

@tblivet tblivet closed this Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants