Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've noticed that info.yml files are quite heterogeneous. Sometimes module names have single quotes, sometimes not. Same deal for module descriptions which can have no quote or single/double quotes.
Why wouldn't we unify all this and decide for instance that module names shouldn't have single quotes and descriptions should always have them and end with a full stop? I'm not making this up, just suggesting this based on the most common denominator in the current codebase.
I've thus applied this cleanup for all modules that weren't following this syntax.
Comment | File | Size | Author |
---|---|---|---|
#18 | interdiff-2116897-10-18.txt | 3.32 KB | MaskyS |
#18 | Edited-info.ymls-2116897-18.patch | 13.67 KB | MaskyS |
#12 | interdiff-2116897-3-10.txt | 5.09 KB | MaskyS |
#10 | Updated-info.yml-to-unified-format-2116897-10.patch | 12.18 KB | MaskyS |
#3 | yml-module-cleanup-VERSION.patch | 7.26 KB | anavarre |
Comments
Comment #1
dawehner.
Comment #3
anavarreOh that's unfortunate. #2095943: Core modules and themes missing the version attribute in info.yml was committed yesterday and it broke this patch. Here's an updated patch that I applied successfully against HEAD just now.
Comment #6
anavarreSome data:
So it'd seem that in Core we'd prefer the
name
anddescription
value to be set without single quotes.Comment #9
MaskyS CreditAttribution: MaskyS at Google Code-In commentedI think that this is a good idea, but first we need to set this to 8.3.x dev. I'm going to assign this to myself and start working on it. The data is quite outdated though. Here is a new set:
Comment #10
MaskyS CreditAttribution: MaskyS at Google Code-In commentedHere is the patch for removing quotes from names and for adding them to description as suggested by reporter. If ever its decided to remove quotes for description as well, then I'd be happy to make another patch :)
Comment #11
MaskyS CreditAttribution: MaskyS at Google Code-In commentedComment #12
MaskyS CreditAttribution: MaskyS at Google Code-In commentedHere's the interdiff :)
Comment #13
tstoecklerI personally do it this way: As soon as a string contains a space then I enclose the string in single quotes. That is what the Symfoner YAML encoder does, so this makes various handcrafted YAMLs nicely consistent with exported configuration.
Comment #14
anavarreMakes sense. Also, I found the PECL YAML extension is way stricter than the Symfony YAML parser so it's likely going to help bring consistency and better formatting altogether.
Comment #15
dawehnerI'm wondering whether we could/should integrate this into a phpcs rule, so for example contrib modules don't have to think about it, but rather just check the rules.
Comment #16
MaskyS CreditAttribution: MaskyS at Google Code-In commented@dawehner I don't think we should force this on them as it might render some modules unusable. I'd rather that we adopt this as a standard...
Comment #17
gvsoThere are descriptions which were not enclosed in single quotes. Plus, some of them don't have a period (.) at the end.
It won't. Adding it into a phpcs rule will only let developers know they are not following the standards if they check their code.
Comment #18
MaskyS CreditAttribution: MaskyS at Google Code-In commented@gvso thanks for the review! Here is a patch and its interdiff for fixing the few decriptions that were not edited. If phpcs won't break anything(forgive my noob knowledge), then sure, somebody please implement it!
Comment #19
gvso@Kifah Meeran, I guess we need to decide which convention we are going to follow first before working on a patch.
Comment #20
gvsoComment #28
quietone CreditAttribution: quietone as a volunteer commentedClosing this as a duplicate of #2994928: Quote consistency in .info.yml files for Core modules
Comment #31
quietone CreditAttribution: quietone as a volunteer commentedLooks like I forgot to change the status here. I did move credit.