There is inconsistent with names of directories. Why for the
- modules/
- includes/
- themes/
- scripts/
- tests/
directory the plural name used and for the
- lib/
- vendor/
directory the singular name used?

I think the lib/ and vendor/ should be renamed to libs/ and vendors/ respectively.

Comments

catch’s picture

Category: bug » task
Priority: Major » Minor

There's was lots and lots of discussion of these before the patch went in. Either way this isn't a major bug, downgrading.

sun’s picture

Status: Active » Closed (duplicate)
effulgentsia’s picture

Title: Rename the core/lib directory to core/libs » Be consistent with singular vs. plural naming of folders
Component: other » base system
Status: Closed (duplicate) » Active
Issue tags: -Coding standards, -API clean-up +consistency

Re-opening this as a spin-off of #1400748-175: Proposal for unified namespace organization, warranting its own issue rather than bogging that one down.

"lib" and "vendor" were chosen as names to follow conventions used by other projects. Looks like one of those projects, ZF2, names their module folder "module" rather than "modules".

OTOH, on my Mac, if I do ls /, I get several folders, including the following:

  • usr
  • Users
  • Applications
  • Library

And if I look at Drupal's database tables, I see (which in my opinion, warrants its own separate issue to address, just pointing it out):

  • node
  • users

So, I guess some questions are:

  • Do we think having all folder names as singular is a good idea? Can we get any confirmation from other projects, usability studies, etc.?
  • Is the benefit worth making the change?
Crell’s picture

Our SQL standards specify singular names for tables. "users" is still plural because "user" is a reserved word in many databases, and it was easier to just leave it as an exception than to try and figure out the insane escaping we'd need to do otherwise.

I don't know if there is a broader convention for such things. If there is, someone should mention it to the PSR group, and see if a standard can be formed. :-)

webchick’s picture

Oh could we please not? Moving all the stuff into a /core directory, which will require endless amounts of documentation updates, at least had a practical benefit. This is pedantic silliness IMO.

hinikato’s picture

Please also consider to use singular instead of using plural. So I suggest to use only one form without using of multiple forms without reasons for the following directories:
includes/
lib/
misc/
modules/
scripts/
tests/
themes/
vendor/

Let's try to see how it could look if we would use the singular names:
- include/
- lib/
- misc/
- module/
- script/
- test/
- theme/
- vendor/

Let's try to see how it could look if would use the plural names:
- includes/
- libs/
- misc/
- modules/
- scripts/
- tests/
- themes/
- vendors/

Does it look more consistent than the current layout of directories?

joachim’s picture

I see 'vendor' as being an adjective rather than a noun -- we don't put actual vendors in that folder (it's rather cramped, they wouldn't like it), but vendor packages.

'lib' on the other hand would be nicer as 'libraries' -- mostly because contrib has being using 'sites/all/libraries' for years now, and here's an occasion where core should really follow that lead.

Crell’s picture

What the libraries module in contrib calls a "library" and what we're putting in the lib folder have nothing to do with each other. The libraries folder is more analagous to vendor. That's already being discussed elsewhere.

Pancho’s picture

Title: Be consistent with singular vs. plural naming of folders » Rename folders to be consistently singular
Priority: Minor » Normal
Issue tags: +DX (Developer Experience), +Coding standards

Re #6:
/vendor/ is an absolute industry standard, we're finally adopting. We certainly don't want to mess with that.
/lib/ is a bit less standardized, you can also find /src/ or other names in other projects. However, it is one of the standard directory names and we don't want to mess with that either.

So all we could possibly do is rename everything to the singular. While that'd be an option, the other one is not.
Reprioritizing as normal: even though I personally don't care much, this is a reasonable approach which we might adopt or not.

klonos’s picture

Title: Rename folders to be consistently singular » Rename folders under /core to be consistently singular

While singular might make sense for anything under /core, I still believe we should keep /sites /modules /themes /profiles /libraries /files. Reason being that anything outside /core is meant for end users - not devs.

Crell’s picture

Version: 8.0.x-dev » 9.x-dev
Issue summary: View changes

This is probably won't-fix, but at least no one is getting back to it for quite some time. :-)

dawehner’s picture

Yeah I really don't think this is an actual problem, especially with /sites clearly communicates that Drupal has the multisite feature, which /site
would not. /site would sound like /app in many other standard frameworks. I think really this is not an actual real existing problem to deal with.

Crell’s picture

Status: Active » Closed (won't fix)

Let's do that then.

Version: 9.x-dev » 9.0.x-dev

The 9.0.x branch will open for development soon, and the placeholder 9.x branch should no longer be used. Only issues that require a new major version should be filed against 9.0.x (for example, removing deprecated code or updating dependency major versions). New developments and disruptive changes that are allowed in a minor version should be filed against 8.9.x, and significant new features will be moved to 9.1.x at committer discretion. For more information see the Allowed changes during the Drupal 8 and 9 release cycles and the Drupal 9.0.0 release plan.