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
Comment #2
adamzimmermann CreditAttribution: adamzimmermann at Chromatic commentedI 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.
Note that coder is present again after downgrading.
Comment #3
natew CreditAttribution: natew as a volunteer commentedI 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.
Comment #4
AaronBaumanCan confirm same symptom here: 8.3.9 causes phpcs to be unable to find Drupal coding standard
Downgrading to 8.3.8 fixes problem.
Comment #5
adamzimmermann CreditAttribution: adamzimmermann at Chromatic commentedI 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.
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.
Comment #6
klausiAha, 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.
Comment #7
klausiOpened Composer issue at https://github.com/composer/composer/issues/8893
Comment #8
jungleFound a workaround to get coder installed from packagist explicitly
Remove Drupal composer repository temporarily first in composer.json
composer update drupal/coder squizlabs/php_codesniffer -vvv
to get the new version installed from packagist.composer update --lock
to update thecontent-hash
value incomposer.lock
.(Cross-posting, see the original comment here)
Comment #9
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedI 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.
Comment #10
mmjvb CreditAttribution: mmjvb as a volunteer commentedTry Composer v2 and exclude drupal/coder on Drupal repository.
Comment #11
RoloDMonkey CreditAttribution: RoloDMonkey at Third and Grove commentedShould this be considered a critical issue? It is breaking my continuous integration and deployments.
Comment #12
kim.pepper@RoloDMonkey You can hotfix your projects by adding:
to your projects composer.json.
Comment #13
Arlina CreditAttribution: Arlina at Chapter Three for Apigee commentedSubscribing to the thread. We are using #12 in our CI workflow for now.
Comment #14
DamienMcKennaAnother +1 for the change in #12 being a reasonable temporary workaround.
Comment #15
jedgar1mx CreditAttribution: jedgar1mx commentedYes, #12 works for me. Thanks
Comment #16
ion.macaria CreditAttribution: ion.macaria commentedI think this can be a critical, because all projects use coder from ./vendor/drupal and last version can't be used.
Comment #17
minorOffense CreditAttribution: minorOffense at Coldfront Labs Inc. commentedYeah 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.
Comment #18
mpotter CreditAttribution: mpotter at Phase2 commentedThe 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.
Comment #19
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedThis will probably be fixed as part of #3135034: 8.9.x-dev tarball INCLUDES CODER AS A MODULE (!) because Composer packages.drupal.org definition incorrect for Coder 8.3.9. These two issues are probably duplicates.
Comment #21
klausiThis 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.Comment #22
acbramley CreditAttribution: acbramley at PreviousNext for Service NSW commentedCan confirm updating keeps coder in place and no longer removes squizlabs/php_codesniffer 🎉