Skip to content

Add prompt suggesting using --dev when require command is used with dev packages#10960

Merged
Seldaek merged 2 commits intocomposer:mainfrom
Seldaek:req_suggest_dev
Jul 21, 2022
Merged

Add prompt suggesting using --dev when require command is used with dev packages#10960
Seldaek merged 2 commits intocomposer:mainfrom
Seldaek:req_suggest_dev

Conversation

@Seldaek
Copy link
Copy Markdown
Member

@Seldaek Seldaek commented Jul 21, 2022

First suggested in #10939

This implements the idea discussed here tho #10939 (comment)

Currently taking dev, testing, static analysis tags as indicator that a package is meant to be in require-dev, then it does this:

image

IMO testing and static analysis are fairly safe bets. dev is almost unused atm, and I took a look at all the top download packages there and only one is arguably not meant to be in require-dev, but they can fix that by removing the tag from the default branch.

@Seldaek Seldaek added this to the 2.4 milestone Jul 21, 2022
@Seldaek Seldaek requested a review from naderman July 21, 2022 11:14
return 0;
}

$input->setOption('dev', true);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this here for now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just correctness, in case any new code below would check $input->getOption('dev'), as this effectively switches the mode we're running in.

Co-authored-by: Nils Adermann <naderman@naderman.de>
@Seldaek Seldaek merged commit e59812c into composer:main Jul 21, 2022
@Seldaek Seldaek deleted the req_suggest_dev branch July 21, 2022 12:40
GaryJones added a commit to PHPCompatibility/PHPCompatibilityWP that referenced this pull request Sep 4, 2022
As per https://getcomposer.org/doc/04-schema.md#keywords by including "static analysis" as a keyword in the `composer.json` file, Composer 2.4.0-RC1 and later will prompt users if the package is installed with `composer require` instead of `composer require --dev`. See composer/composer#10960 for more info.
GaryJones added a commit to Automattic/phpcs-neutron-standard that referenced this pull request Sep 4, 2022
As per https://getcomposer.org/doc/04-schema.md#keywords by including "static analysis" as a keyword in the `composer.json` file, Composer 2.4.0-RC1 and later will prompt users if the package is installed with `composer require` instead of `composer require --dev`. See composer/composer#10960 for more info.

The "phpcs" keyword is to match other coding-standards packages.
staabm added a commit to staabm/phpstan-dba that referenced this pull request Feb 15, 2023
as per composer/composer#10960 this allows composer to warn the user, when installing the toolsas a project dependency instead of a dev-dependency
staabm added a commit to staabm/annotate-pull-request-from-checkstyle that referenced this pull request Feb 15, 2023
as per composer/composer#10960 this allows composer to warn the user, when installing the tool as a project dependency instead of a dev-dependency
weirdan added a commit to weirdan/psalm that referenced this pull request Feb 15, 2023
icanhazstring added a commit to composer-unused/composer-unused that referenced this pull request Feb 20, 2023
This tells composer to install composer-unused to require-dev when running composer require without --dev
composer/composer#10960
icanhazstring added a commit to composer-unused/composer-unused that referenced this pull request Feb 20, 2023
This tells composer to install composer-unused to require-dev when running composer require without --dev
composer/composer#10960
staabm added a commit to staabm/php-cs-fixer-config-1 that referenced this pull request Mar 13, 2023
as per composer/composer#10960 this allows composer to warn the user, when installing the tool as a project dependency instead of a dev-dependency
gharlan pushed a commit to redaxo/php-cs-fixer-config that referenced this pull request Mar 13, 2023
as per composer/composer#10960 this allows
composer to warn the user, when installing the tool as a project
dependency instead of a dev-dependency
reinfi pushed a commit to reinfi/composer-unused that referenced this pull request Mar 14, 2023
This tells composer to install composer-unused to require-dev when running composer require without --dev
composer/composer#10960
staabm added a commit to staabm/bladestan that referenced this pull request Mar 16, 2023
as per composer/composer#10960 this allows composer to warn the user, when installing the tool as a project dependency instead of a dev-dependency
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants