Skip to content
This repository was archived by the owner on Oct 19, 2022. It is now read-only.

Rename phpcs.xml to ruleset.xml #2

Merged
merged 1 commit into from
Mar 31, 2019
Merged

Rename phpcs.xml to ruleset.xml #2

merged 1 commit into from
Mar 31, 2019

Conversation

jamesmehorter
Copy link
Contributor

In order for phpcodesniffer-composer-installer to automatically install rulesets loaded via Composer, the ruleset file must be named ruleset.xml. This seems to be completely undocumented anywhere—but while named phpcs.xml, phpcodesniffer-composer-installer does not automatically install the ruleset.

With this change, after installing with Composer, you can immediately see phpcs-laravel listed as an installed ruleset with phpcs -i. And likewise, you can then use it with: phpcs --standard=phpcs-laravel.

…fer-composer-installer

This seems to be completely undocumented anywhere :( :(

In order for phpcodesniffer-composer-installer to automatically install rulesets loaded via Composer, the ruleset file _must_ be named ruleset.xml

With this change, after installing with composer, you can immediately call `phpcs -i` and see `phpcs-laravel` listed as an installed sniff. Then you can use it with: `phpcs --standard=phpcs-laravel`
@jamesmehorter
Copy link
Contributor Author

The closest documentation I could find is here https://github.com/Dealerdirect/phpcodesniffer-composer-installer#developing-coding-standards and here https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standard-Tutorial

They have you create a ruleset as ruleset.xml, but it's not mentioned that this is a hard requirement.

@jamesmehorter
Copy link
Contributor Author

Using this method: https://github.com/Dealerdirect/phpcodesniffer-composer-installer#calling-the-plugin-directly

Before the name change:

→ composer run-script install-codestandards              
> Dealerdirect\Composer\Plugin\Installers\PHPCodeSniffer\Plugin::run
PHP CodeSniffer Config installed_paths set to ../../automattic/vipwpcs,../../sirbrillig/phpcs-import-detection,../../sirbrillig/phpcs-variable-analysis,../../wp-coding-standards/wpcs

After the name change

→ composer run-script install-codestandards
> Dealerdirect\Composer\Plugin\Installers\PHPCodeSniffer\Plugin::run
PHP CodeSniffer Config installed_paths set to ../../sirbrillig/phpcs-import-detection,../../sirbrillig/phpcs-variable-analysis,../../wp-coding-standards/wpcs,../../emielmolenaar,../../automattic/vipwpcs

Note the addition of ../../emielmolenaar

@emielmolenaar emielmolenaar merged commit eec0396 into emielmolenaar:master Mar 31, 2019
@emielmolenaar
Copy link
Owner

Thank you @jamesmehorter !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants