Currently the drupal/coder project is available from 2 different repositories, the default packagist.org repository and the drupal.org repository.

Running composer show drupal/coder --all against the packagist.org version returns the following:

name     : drupal/coder
descrip. : Coder is a library to review Drupal code.
keywords : code review, phpcs, standards
versions : * 8.3.9, 8.3.8, 8.3.7, 8.3.6, 8.3.5, 8.3.4, 8.3.3, 8.3.2, 8.3.1, 8.3.0, 8.2.12, 8.2.11, 8.2.10, 8.2.9, 8.2.8, 8.2.7, 8.2.6, 8.2.5, 8.2.4, 8.2.3, 8.2.2, 8.2.1, 8.2.0, 8.2.0-rc1, 8.2.0-beta1, 8.2.0-alpha2, 8.2.0-alpha1, 7.2.5, 7.2.4, 7.2.3, 7.2.2, dev-8.x-3.x, dev-8.x-2.x, dev-7.x-2.x
type     : phpcodesniffer-standard
license  : GNU General Public License v2.0 or later (GPL-2.0+) (OSI approved) https://spdx.org/licenses/GPL-2.0+.html#licenseText
homepage : https://www.drupal.org/project/coder
source   : [git] https://git.drupalcode.org/project/coder.git d51e0b8c6561e21c0545d04b5410a7bed7ee7c6b
dist     : []  
path     : /home/arkener/.config/composer/vendor/drupal/coder
names    : drupal/coder

autoload
psr-4
Drupal\ => coder_sniffer/Drupal/
DrupalPractice\ => coder_sniffer/DrupalPractice/

requires
ext-mbstring *
php >=7.0.8
squizlabs/php_codesniffer ^3.5.5
symfony/yaml >=2.0.5

requires (dev)
phpstan/phpstan ^0.12.5
phpunit/phpunit ^6.0 || ^7.0

Running composer show drupal/coder --all against the packages.drupal.org version returns the following:

name     : drupal/coder
descrip. : 
keywords : 
versions : * 8.3.9, 8.3.8, 8.3.7, 8.3.6, 8.3.5, 8.3.4, 8.3.3, 8.3.2, 8.3.1, 8.3.0, 8.2.12, 8.2.11, 8.2.10, 8.2.9, 8.2.8, 8.2.7, 8.2.6, 8.2.5, 8.2.4, 8.2.3, 8.2.2, 8.2.1, 8.2.0, 8.2.0-rc1, 8.2.0-beta1, 8.2.0-alpha2, 8.2.0-alpha1, 7.2.5, 7.2.4, 7.2.3, 7.2.2, 3.x-dev, 3.8.0, 3.7.0, 3.6.0, 3.5.0, 3.4.0, 3.3.0, 3.2.0, 3.1.0, 3.0.0, 2.x-dev, 2.12.0, 2.11.0, 2.10.0, 2.9.0, 2.8.0, 2.7.0, 2.6.0, 2.5.0, 2.4.0, 2.3.0, 2.2.0, 2.1.0, 2.0.0, 2.0.0-rc1, 2.0.0-beta1, 2.0.0-alpha2, 2.0.0-alpha1, dev-8.x-3.x, dev-8.x-2.x, dev-7.x-2.x, dev-3.x, dev-2.x
type     : drupal-module
license  : GNU General Public License v2.0 or later (GPL-2.0-or-later) (OSI approved) https://spdx.org/licenses/GPL-2.0-or-later.html#licenseText
homepage : https://www.drupal.org/project/coder
source   : [git] https://git.drupalcode.org/project/coder.git 8.3.9
dist     : [zip] https://ftp.drupal.org/files/projects/coder-8.3.9.zip 8.3.9
path     : /usr/share/nginx/html/project/composer/vendor/drupal/coder
names    : drupal/coder

support
source : https://git.drupalcode.org/project/coder

requires
drupal/core ~8.0

requires (dev)
drupal/rules *

It seems like the packages.drupal.org version ignores the included composer.json file and for some reason adds a dev dependency on the rules project. This means that the drupal/coder package currently doesn't work in combination with the dealerdirect/phpcodesniffer-composer-installer package, as the type isn't set to "phpcodesniffer-standard". This issue can be reproduced using the following composer file:

{
    "name": "coder/example",
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require-dev": {
        "drupal/coder": "8.3.9"
    }
}

I'm currently not sure if this is a coder or an infrastructure issue, does anybody have any idea?

Comments

Arkener created an issue. See original summary.

adamzimmermann’s picture

I was coming here to file my own and found this. I think this issue is directly related to what I'm seeing.

I began seeing this in my builds this morning for multiple projects on the PR where Dependabot updated our repo to user drupal/coder:8.3.9. This is the symptom and not the problem. I found that the dependency was simply not being installed with the steps below.

ERROR: the "Drupal" coding standard is not installed. The installed coding standards are MySource, PSR12, PEAR, PSR1, PSR2, Squiz and Zend

I tested it out with some manual composer operations to see what was going on.

Note that coder is missing.

(dependabot/composer/drupal/coder-8.3.9)$ ls ./vendor/drupal/
console			console-core		console-en		console-extend-plugin	core-composer-scaffold
(dependabot/composer/drupal/coder-8.3.9)$ composer require drupal/coder:8.3.8

Note that coder is present again after downgrading.

(dependabot/composer/drupal/coder-8.3.9)$ ls ./vendor/drupal/
coder			console-core		console-extend-plugin
console			console-en		core-composer-scaffold
natew’s picture

I have the same symptoms as adamzimmermann, in our CI, from a quick look. It appears that coder is now in contrib instead of vendor (because of the type change as mentioned) when I do a composer install. As a work around, for now, I am going to use 8.3.8.

AaronBauman’s picture

Can confirm same symptom here: 8.3.9 causes phpcs to be unable to find Drupal coding standard
Downgrading to 8.3.8 fixes problem.

adamzimmermann’s picture

I missed the type change in the original comment.

With that in mind, I simply changed our execution script to have this and my code style checks work again.

vendor/bin/phpcs --config-set installed_paths web/modules/contrib/coder/coder_sniffer

This could also be fixed with the installer-paths section of the composer.json in a repo.
https://getcomposer.org/doc/faqs/how-do-i-install-a-package-to-a-custom-...

I guess the real question is, was that change intentional? If so, the release notes or some instruction page should probably explain the change. I'm happy to help draft something if that is the case.

klausi’s picture

Aha, I tried the new semantic versioning on drupal.org, so this seems like a drupal.org infrastructure issue. Let's keep this issue open in coder, maybe we can find a hack workaround to make Coder installable again.

Opened infrastructure issue at #3135034: 8.9.x-dev tarball INCLUDES CODER AS A MODULE (!) because Composer packages.drupal.org definition incorrect for Coder 8.3.9.

klausi’s picture

jungle’s picture

Found a workaround to get coder installed from packagist explicitly

  1.      "repositories": [
    -        {
    -            "type": "composer",
    -            "url": "https://packages.drupal.org/8"
    -        },
    

    Remove Drupal composer repository temporarily first in composer.json

  2. Run composer update drupal/coder squizlabs/php_codesniffer -vvv to get the new version installed from packagist.
  3. Revert the removal of Drupal composer repository
  4. Run composer update --lock to update the content-hash value in composer.lock.

(Cross-posting, see the original comment here)

greg.1.anderson’s picture

I commented on the Composer Github issue. Might you consider removing all tags / releases from drupal.org, and rely on Packagist for distribution?

Non-Composer sites would have to do some sort of manual install, so perhaps it might be better to ask Drupal infra for a way to just keep Coder out of packages.drupal.org.

mmjvb’s picture

Try Composer v2 and exclude drupal/coder on Drupal repository.

RoloDMonkey’s picture

Should this be considered a critical issue? It is breaking my continuous integration and deployments.

kim.pepper’s picture

@RoloDMonkey You can hotfix your projects by adding:

"conflict": {
        "drupal/coder": ">8.3.8"
 }

to your projects composer.json.

Arlina’s picture

Subscribing to the thread. We are using #12 in our CI workflow for now.

DamienMcKenna’s picture

Another +1 for the change in #12 being a reasonable temporary workaround.

jedgar1mx’s picture

Yes, #12 works for me. Thanks

ion.macaria’s picture

Priority: Major » Critical

I think this can be a critical, because all projects use coder from ./vendor/drupal and last version can't be used.

minorOffense’s picture

Yeah this is pretty critical. We do coding standards checks on commit and they all fail with the latest version since it can't find the coding standards defined by Coder.

mpotter’s picture

The workaround in #12 worked for me. This is definitely critical. All of our local testing scripts and cloud CI across dozens of projects are set to use phpcs within /vendor/bin. Coder is not a Drupal module and should not be installed into modules/contrib.

greg.1.anderson’s picture

klausi credited drumm.

klausi’s picture

Status: Active » Fixed

This has now been fixed by #3135034: 8.9.x-dev tarball INCLUDES CODER AS A MODULE (!) because Composer packages.drupal.org definition incorrect for Coder 8.3.9, thanks drumm!

composer update drupal/coder --with-dependencies now works normally for me again in my projects. You should be able to remove the conflict hack from above now.

acbramley’s picture

Can confirm updating keeps coder in place and no longer removes squizlabs/php_codesniffer 🎉

Status: Fixed » Closed (fixed)

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