Seravo / wordpress

The WordPress project layout used by many of Seravo's customers, suitable also for local development with Vagrant and git deployment
https://seravo.com
GNU General Public License v3.0
102 stars 54 forks source link

phpcbf is actually phpcs? #123

Closed k1sul1 closed 4 years ago

k1sul1 commented 4 years ago

Whilst developing Seravo/woo-pakettikauppa, I tried to use phpcbf in the dockerized version of this environment. I was wondering why the errors aren't getting fixed and why it just reported the errors instead, and the cause seems to be that phpcs & phpcbf are the same.

root@development:~/htdocs/wp-content/plugins/woo-pakettikauppa# which phpcs
/usr/local/bin/phpcs
root@development:~/htdocs/wp-content/plugins/woo-pakettikauppa# which phpcbf
/usr/local/bin/phpcbf
root@development:~/htdocs/wp-content/plugins/woo-pakettikauppa# cat /usr/local/bin/phpcbf
#!/usr/bin/env php
<?php
/**
 * PHP_CodeSniffer detects violations of a defined coding standard.
 *
 * @author    Greg Sherwood <gsherwood@squiz.net>
 * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
 * @license   https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
 */

if (is_file(__DIR__.'/../autoload.php') === true) {
    include_once __DIR__.'/../autoload.php';
} else {
    include_once 'PHP/CodeSniffer/autoload.php';
}

$runner   = new PHP_CodeSniffer\Runner();
$exitCode = $runner->runPHPCS();
exit($exitCode);
root@development:~/htdocs/wp-content/plugins/woo-pakettikauppa# cat /usr/local/bin/phpcs
#!/usr/bin/env php
<?php
/**
 * PHP_CodeSniffer detects violations of a defined coding standard.
 *
 * @author    Greg Sherwood <gsherwood@squiz.net>
 * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
 * @license   https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
 */

if (is_file(__DIR__.'/../autoload.php') === true) {
    include_once __DIR__.'/../autoload.php';
} else {
    include_once 'PHP/CodeSniffer/autoload.php';
}

$runner   = new PHP_CodeSniffer\Runner();
$exitCode = $runner->runPHPCS();
exit($exitCode);
root@development:~/htdocs/wp-content/plugins/woo-pakettikauppa#

In this case it doesn't matter since I was supposed to use a spesific version anyway (I just forgot to prefix the path), but this should probably get fixed anyway.

ottok commented 4 years ago

Thanks for noticing! This was a regression since January and is now fixed in latest Docker image.

vagrant@development:~$ phpcs --help

Usage: phpcs [-nwlsaepqvi] [-d key[=value]] [--colors] [--no-colors]
...

vagrant@development:~$ phpcbf --help

Usage: phpcbf [-nwli] [-d key[=value]] [--ignore-annotations] [--bootstrap=<bootstrap>]
...