PHPCSStandards / composer-installer

Composer installer for PHP_CodeSniffer coding standards
https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer
MIT License
549 stars 36 forks source link

Removal of search depth without dependency change does not update installed paths #150

Open jrfnl opened 2 years ago

jrfnl commented 2 years ago

Problem/Motivation

The plugin updates the installed_paths when the installed dependencies have changed or the search depth has changed.

However, when the phpcodesniffer-search-depth is removed and the Dealerdirect\Composer\Plugin\Installers\PHPCodeSniffer\Plugin::run() method is run, the plugin does not update the installed_paths.

So effectively, removing the phpcodesniffer-search-depth setting does not revert the search depth to the default search depth unless the installed dependencies are changed.

Discovered while working on the tests.

Expected behaviour

That the installed_paths would be updated based on the default search depth when the key is removed from extra in the composer.json file.

Actual behaviour

The installed_paths are still based on the old/removed search depth setting.

Steps to reproduce

Will follow once some "fake" (fixture) standards are in place for the tests as a standard which needs a "high" search depth is needed to demonstrate the issue and I don't know of one in the wild.

Proposed changes

To be determined

Environment

Question Answer
OS not relevant
PHP version not relevant
Composer version 2.2.5
PHP_CodeSniffer version 3.x
Dealerdirect PHPCS plugin version master
Install type not relevant

Tested against master branch?