Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PHP tool binaries for BSU WordPress development. Installed via npm, ships the fo

| Binary | Version | Purpose |
|---|---|---|
| `phpcs` | 4.x | PHP CodeSniffer — enforces BSUWordPressCS coding standards |
| `phpcs` | 4.x | PHP CodeSniffer — enforces bsu-phplint coding standards |
| `phpcbf` | 4.x | PHP Code Beautifier — auto-fixes PHPCS violations |
| `phpstan` | 1.x | PHPStan — static analysis for type safety and correctness |

Expand Down
14 changes: 7 additions & 7 deletions bin/register-bsuwordpresscs.php → bin/register-bsu-phplint.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?php
/**
* Register the BSUWordPressCS standard with PHP_CodeSniffer.
* Register the bsu-phplint standard with PHP_CodeSniffer.
*
* The dealerdirect composer installer regenerates CodeSniffer.conf on every
* composer install/update and only registers composer-installed standards, so
* the consumer-side BSUWordPressCS path is dropped each time. This composer
* the consumer-side bsu-phplint path is dropped each time. This composer
* post-install/post-update hook re-appends it, so consuming repos can resolve
* the BSUWordPressCS standard by name.
* the bsu-phplint standard by name.
*
* The path is relative to the phpcs directory (vendor/squizlabs/php_codesniffer),
* reaching @bsu/BSUWordPressCS installed as a sibling in the consumer's
* reaching @bsu/bsu-phplint installed as a sibling in the consumer's
* node_modules/@bsu/.
*/

$phpcs = __DIR__ . '/../vendor/bin/phpcs';
$bsu_path = '../../../../BSUWordPressCS';
$bsu_path = '../../../../bsu-phplint';

if ( ! is_file( $phpcs ) ) {
return;
Expand All @@ -27,11 +27,11 @@

/* Nothing to do if it is already registered. */
if ( in_array( $bsu_path, $paths, true ) ) {
echo "BSUWordPressCS already registered in phpcs installed_paths.\n";
echo "bsu-phplint already registered in phpcs installed_paths.\n";
return;
}

/* Append it and write the config back through phpcs itself. */
$paths[] = $bsu_path;
shell_exec( escapeshellarg( PHP_BINARY ) . ' ' . escapeshellarg( $phpcs ) . ' --config-set installed_paths ' . escapeshellarg( implode( ',', $paths ) ) . ' 2>/dev/null' );
echo "Registered BSUWordPressCS in phpcs installed_paths.\n";
echo "Registered bsu-phplint in phpcs installed_paths.\n";
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
},
"scripts": {
"post-install-cmd": "@php bin/register-bsuwordpresscs.php",
"post-update-cmd": "@php bin/register-bsuwordpresscs.php"
"post-install-cmd": "@php bin/register-bsu-phplint.php",
"post-update-cmd": "@php bin/register-bsu-phplint.php"
}
}
4 changes: 2 additions & 2 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '31095481485cd719e8243d8fcd3aef3db61449e1',
'reference' => 'f1a8e2bbb71ef3efb8af5bd7d6ef3d59a5a78e5a',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'reference' => '31095481485cd719e8243d8fcd3aef3db61449e1',
'reference' => 'f1a8e2bbb71ef3efb8af5bd7d6ef3d59a5a78e5a',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand Down
2 changes: 1 addition & 1 deletion vendor/squizlabs/php_codesniffer/CodeSniffer.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$phpCodeSnifferConfig = array (
'installed_paths' => '../../phpcsstandards/phpcsextra,../../phpcsstandards/phpcsutils,../../wp-coding-standards/wpcs,../../../../BSUWordPressCS',
'installed_paths' => '../../phpcsstandards/phpcsextra,../../phpcsstandards/phpcsutils,../../wp-coding-standards/wpcs,../../../../bsu-phplint',
);
?>