Problem/Motivation

Drupal Core uses the Composer coding standard for composer.json / composer.lock. However, the project's composer.json applies the Drupal default coding standard.

Proposed resolution

Apply Drupal core coding standards to composer.json

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review
StatusFileSize
new2.4 KB

Attached patch applies Drupal core coding standards to composer.json

steven buteneers’s picture

Status: Needs review » Needs work

I'm not sure what went wrong but this patch does not apply properly. Authors are suddenly added outside of the "authors" property.
Also punctuation is broken.

idebr’s picture

What command are you using to apply the patch? Is the command reporting any errors?

steven buteneers’s picture

Hi idebr,

Just a regular git apply. But if you take a look at the patch yourself you can clearly see the problem.

anybody’s picture

Wouldn't it be better to completely remove the composer.json file? It's being created automatically by Drupal.org and adding it manual adds the risk to be different from info.yml.

dmsmidt’s picture

@Anybody, interesting, where is that documented?
Not here: https://www.drupal.org/docs/creating-custom-modules/add-a-composerjson-file

anybody’s picture

@dmsmidt: SORRY! -.- I was wrong, you're right! I'm not sure how I got to that conclusion but I guess because of the compatibility information checked by composer when you require a new project (core compatibility). Sorry for the confusion and my stupid mistake!

Anyway I guess the composer.yml in this projects prevents it from (composer) Drupal 9 compatibility so marking this related: #3150122: composer.json is not Drupal 9 compatible

I guess we can use the same string as in the .info.yml?

^8 || ^9

For that #2 would also need work.

anybody’s picture

Status: Needs work » Needs review
StatusFileSize
new276 bytes
new2.41 KB

Reroll of #2 attached with interdiff. Please review.

mrpauldriver’s picture

I unable to the install the module with composer on a D9 site. I also have the patch at #9 in my composer.json (using cweagans/composer-patches).

The backtrace is quite lengthy, so please take a look at this Pastebin.

  • Steven Buteneers committed a2195c7 on 8.x-1.x
    Issue #3119712 by Anybody, idebr: Apply Drupal core coding standards to...
steven buteneers’s picture

Status: Needs review » Fixed

Thank for reporting this issue and providing the patch.
I committed the changes.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.