Problem/Motivation
The dependencies in *.info.yml files as a best practice should have the project specified https://www.drupal.org/node/2299747.
Currently Drupal core has a dependency on the Link project. This is because it specifies the link module as a dependency and projects with the same name as the module are preferred.
Currently the automated testing infrastructure (Project Dependency) assumes that Drupal core has no dependencies so the erroneous dependency on the Link project is ignored.
It is important for Drupal core to use best practices because contributed projects will follow the example set by core and specifying dependencies in an ambiguous manner may cause problems with automated testing. Also, if in the future Drupal core uses external dependencies it may not always be the case that Drupal core does not have dependencies.
Proposed resolution
Replace all dependencies that are not namespaced with their namespaced versions.
Remaining tasks
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#16 | interdiff.txt | 1.25 KB | ankitjain28may |
#16 | Add-namespaces-2798891-16.patch | 70.09 KB | ankitjain28may |
#11 | Add-namespaces-2798891-11.patch | 77.49 KB | ankitjain28may |
#8 | Add-namespaces-2798891.patch | 69.33 KB | ankitjain28may |
#2 | add_project_namespaces-2798891-2.patch | 53.79 KB | trobey |
Comments
Comment #2
trobey CreditAttribution: trobey as a volunteer commentedComment #6
borisson_Patch doesn't apply anymore for these files.
I do think that this is a great idea, so it would be awesome to get this rerolled.
Comment #7
tstoecklerComment #8
ankitjain28may CreditAttribution: ankitjain28may as a volunteer and commentedRe-rolled
Comment #9
TR CreditAttribution: TR commented+1 for getting this done.
I applied the patch then examined all the .info.yml files in the Drupal distribution (using find, xargs, grep). It's almost entirely correct. However, I found a few problems:
1)
Should be drupal:views, not druapl:views (spelling).
2) None of the profiles in core/profiles were fixed, they all still need namespaces in their .info.yml files.
3)
core/modules/system/tests/modules/module_handler_test_multiple/module_handler_test_multiple_child/module_handler_test_multiple_child.info.yml
was not fixed.Comment #10
ankitjain28may CreditAttribution: ankitjain28may as a volunteer and commented@TR Thanks for the feedback, I will make all the necessary changes.
Comment #11
ankitjain28may CreditAttribution: ankitjain28may as a volunteer and commentedMade the changes as per comment #9
Comment #13
TR CreditAttribution: TR commentedHi @ankitjain28may:
Please create an interdiff to show the differences between #8 and #11. See https://www.drupal.org/documentation/git/interdiff
This is especially important with big patches like yours - I don't want to have to review the entire patch again, I just want to review the changes you made, and I can't do that without an interdiff.
Comment #14
TR CreditAttribution: TR commentedAh, it seems I may have led you astray. See #2855026: Installation profiles do not support project:module format for dependencies. I guess profiles should NOT have namespaces yet, after all.
Comment #15
ankitjain28may CreditAttribution: ankitjain28may as a volunteer and commented@TR I will remove the namespace in profiles and make a new patch with interdiff.
Comment #16
ankitjain28may CreditAttribution: ankitjain28may as a volunteer and at Google Summer of Code commentedAdded interdiff and patch, Please review.
Comment #17
TR CreditAttribution: TR commentedLooks good. Patch in #16 addresses all the concerns I raised in #9. And the tests pass!
Comment #18
catchRe-titling because this looks like a feature addition when it's really clean-up.
Comment #19
catchCommitted d90ac78 and pushed to 8.6.x. Thanks!
Comment #21
alexpottHere are some follow ups:
DrupalPractice.InfoFiles.NamespacedDependency
rule so we can comprehensively address this. Depends on the other two. Also enabling now shows that this change missed lots of test modules.Comment #22
TR CreditAttribution: TR commented@alexpott: Specifically, what's missing? The only .info.yml files that were left out were those that were under core/profiles, and those weren't
"missed" they were deliberately excluded because of #2855026: Installation profiles do not support project:module format for dependencies. After that goes in the profiles can be cleaned up all at once, rather than doing some parts of them now and some later.
Comment #24
geerlingguy CreditAttribution: geerlingguy at Midwestern Mac, LLC commentedComing over from #3011936: Apply new format for dependencies... and this feels so... weird.
When I define a module dependency with composer, it's:
drupal/modulename
And now when I define a module dependency in my module's .info.yml file, it's:
modulename:modulename
But if I define a module dependency for one of the modules in the core/ directory, it's:
drupal:modulename
I am questioning my sanity; was there any CR about why this is the case, or what it's useful for? Especially as we start sticking this into Drupal's default coding standards review, I think it would be nice to know why this is done, and why are introducing another Drupalism here :/
Comment #25
trobey CreditAttribution: trobey as a volunteer commented@geerlingguy: You should be questioning your sanity or at least doing a bit more research. First there is a link to a CR posted right at the top in the Problem/Motivation section. That would be a good place to start. You should not be using
modulename:modulename
anywhere. It should be
project:module
everywhere and the project is optional. In many cases the name of the project is the same as the name of the module. We often refer to installing a "module" when we are installing a project. Projects can contain multiple modules and the lax terminology leads to confusion such as yours. For Project Dependency it makes a huge difference when these terms are used incorrectly. The last line of code is really just the above line of code applied to Drupal core. There is nothing special about this for Drupal core.
The last thing is ":" is often used for scope and this was implemented before Drupal started using Composer. It is not another Drupalism. PHP uses "::" but this has been criticized for not following a simpler one character for scope. I chose to use what is commonly used in many computer languages. Composer uses a forward slash which is more a symbol associated with directories than with scope. Some people may prefer one over the other but they are both acceptable and I do not think it is worthwhile starting an issue over them when we have a lot more important things to address.
Comment #26
trobey CreditAttribution: trobey as a volunteer commentedOne additional point. Composer does not use
drupal/modulename
It uses
drupal/project