-
-
Notifications
You must be signed in to change notification settings - Fork 647
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
[vincentlanglet/twig-cs-fixer] add default config and add message #1696
Conversation
Thanks for the PR 😍 How to test these changes in your application
Diff between recipe versionsIn order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. vincentlanglet/twig-cs-fixer0.6 vs 3.0diff --git a/vincentlanglet/twig-cs-fixer/3.0/post-install.txt b/vincentlanglet/twig-cs-fixer/3.0/post-install.txt
new file mode 100644
index 00000000..9926c2fc
--- /dev/null
+++ b/vincentlanglet/twig-cs-fixer/3.0/post-install.txt
@@ -0,0 +1,4 @@
+
+ You can create a `.twig-cs-fixer.dist.php` and configure to your needs
+ See https://github.com/VincentLanglet/Twig-CS-Fixer/blob/main/docs/configuration.md
+ For configuration explanation. |
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
@VincentLanglet Maybe you can chime in here? |
//$ruleset->addRule(new TwigCsFixer\Rules\File\FileExtensionRule()); | ||
//$ruleset->removeRule(TwigCsFixer\Rules\Whitespace\EmptyLinesRule::class); | ||
//$ruleset->overrideRule( | ||
// new TwigCsFixer\Rules\Punctuation\PunctuationSpacingRule( | ||
// ['}' => 1], | ||
// ['{' => 1], | ||
// ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those classes doesn't exists in 0.6 version cf
https://github.com/VincentLanglet/Twig-CS-Fixer/tree/0.6.0/src
I don't think it's worth to have a recipe for < 3.0.0 since I only maintain the latest major.
So it seems better to only create
vincentlanglet/twig-cs-fixer/3.0/
files, no ?
<bg=green;fg=white></> | ||
<bg=green;fg=white> You can edit the `.twig-cs-fixer.php` to your needs </> | ||
<bg=green;fg=white> See https://github.com/VincentLanglet/Twig-CS-Fixer/blob/main/docs/configuration.md </> | ||
<bg=green;fg=white> For configuration explanation: </> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<bg=green;fg=white> For configuration explanation: </> | |
<bg=green;fg=white> For configuration explanation. </> |
?
] | ||
], | ||
"copy-from-recipe": { | ||
".twig-cs-fixer.php": ".twig-cs-fixer.php" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dunno if we should provide this default config file.
Without config file, I believe my tool is already using TwigCsFixer
standard by default. Which means that if you add this config file like this without changing anything in it, it's just a useless file.
So maybe the post-install message is enough ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats true i just wanted to provide the configuration file with default config and examples from the docs so that the user could edit if they like. I let it up for you to decide to keep it or not :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it can work without the config file, I don't know if it's a good idea to add automatically a config.
I'm unsure how other tools work (and if they can work without a config file)...
But the post-install.txt
is great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah i think its a good addition as you can indicate you can make changes to the config like adding more rule, if you dont change anything you still get the same results. So i'm for it.
As for others i see php-cs-fixer has config: https://github.com/symfony/recipes/blob/main/friendsofphp/php-cs-fixer/3.0/.php-cs-fixer.dist.php but this doesn't work without it i assume
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thank you for contribution.
I assume you've chosen 0.6 due to the last version supporting PHP 7.4, but because of changes in the twig-cs-fixer
config file, this recipe will crash for users on 2.0/3.0; hence, you will need to add 0.6
, 2.0
(Standard
class name is Twig
) and 3.0
. (I didn't check if 0.6 and 1.0 are any different in the config file syntax)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to use the basic Twig standard, another standard and/or add/remove a rule, you can provide your own configuration with a .twig-cs-fixer.php or .twig-cs-fixer.dist.php file
--- vincentlanglet/twig-cs-fixer/0.6/.twig-cs-fixer.php
+++ vincentlanglet/twig-cs-fixer/0.6/.twig-cs-fixer.dist.php
I assume it should be a .dist
file.
$ruleset = new TwigCsFixer\Ruleset\Ruleset(); | ||
|
||
// You can start from a default standard | ||
$ruleset->addStandard(new TwigCsFixer\Standard\TwigCsFixer()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Standard class at 0.6/1.0 is called Generic
.
$ruleset->addStandard(new TwigCsFixer\Standard\Generic());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will revert for 0.6 see: #1696 (comment)
Head branch was pushed to by a user without write access
Folks @VincentLanglet @JohJohan , what do we decide about it? Does this package needs recipe or not? |
Recipe would be useful to update gitignore file for example. But providing a .twig-cs-fixer.dist.php file by default is not needed. |
Okay i will remove the |
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
add default config and add message