tighten/duster

Error when pre-commit checking with php-cs-fixer + lint-staged

benholmen opened this issue · 0 comments

Hey, thanks for Duster! I'm swapping out a tightenco/tlint / friendsofphp/php-cs-fixer / symplify/easy-coding-standard setup that includes lint-staged set up on our precommit hook. Here's the setup:

.git/pre-commit:

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged

package.json:

    "lint-staged": {
        "**/*.php*": [
            "vendor/bin/duster --lint"
        ]
    },

When attempting to commit two files I got the following error - I increased the verbosity for troubleshooting:

> git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file -
[STARTED] Preparing lint-staged...
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] package.json — 2 files
[STARTED] **/*.php* — 2 files
[STARTED] vendor/bin/duster --lint -vvv
[FAILED] vendor/bin/duster --lint -vvv [FAILED]
[FAILED] vendor/bin/duster --lint -vvv [FAILED]
[FAILED] vendor/bin/duster --lint -vvv [FAILED]
[STARTED] Applying modifications from tasks...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Reverting to original state because of errors...
[SUCCESS] Reverting to original state because of errors...
[STARTED] Cleaning up temporary files...
[SUCCESS] Cleaning up temporary files...

✖ vendor/bin/duster --lint -vvv:

Box Requirements Checker
========================

> Using PHP 8.2.1
> PHP is using the following php.ini file:
  /opt/homebrew/etc/php/8.2/php.ini

> Checking Box requirements:
  ✔ The application requires the version "^8.0" or greater.
  ✔ The application requires the extension "zlib".
  
                                                                                
 [OK] Your system is ready to run the application.                              
                                                                                

                              Linting using TLint                               
LGTM!
LGTM!
                         Linting using PHP_CodeSniffer                          
.. 2 / 2 (100%)


Time: 233ms; Memory: 27.13MB

                           Linting using PHP CS Fixer                           

In ConfigurationResolver.php line 559:
                                                                          
  [PhpCsFixer\ConfigurationException\InvalidConfigurationException (16)]  
  For multiple paths config parameter is required.                        
                                                                          

Exception trace:
  at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:559
 PhpCsFixer\Console\ConfigurationResolver->computeConfigFiles() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:249
 PhpCsFixer\Console\ConfigurationResolver->getConfig() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:871
 PhpCsFixer\Console\ConfigurationResolver->resolveFinder() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/friendsofphp/php-cs-fixer/src/Console/ConfigurationResolver.php:500
 PhpCsFixer\Console\ConfigurationResolver->getFinder() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Support/PhpCsFixer.php:76
 App\Support\PhpCsFixer->process() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Support/PhpCsFixer.php:45
 App\Support\PhpCsFixer->lint() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Actions/Clean.php:22
 App\Actions\Clean->App\Actions\{closure}() at n/a:n/a
 array_filter() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/collections/Arr.php:795
 Illuminate\Support\Arr::where() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/collections/Collection.php:388
 Illuminate\Support\Collection->filter() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Actions/Clean.php:22
 App\Actions\Clean->execute() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Commands/DusterCommand.php:24
 App\Commands\DusterCommand->handle() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/Providers/DusterServiceProvider.php:55
 App\Providers\DusterServiceProvider->App\Providers\{closure}() at n/a:n/a
 call_user_func() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/container/Container.php:348
 Illuminate\Container\Container->callMethodBinding() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/container/BoundMethod.php:90
 Illuminate\Container\BoundMethod::callBoundMethod() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/container/BoundMethod.php:35
 Illuminate\Container\BoundMethod::call() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/container/Container.php:663
 Illuminate\Container\Container->call() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/console/Command.php:182
 Illuminate\Console\Command->execute() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/symfony/console/Command/Command.php:291
 Symfony\Component\Console\Command\Command->run() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/console/Command.php:151
 Illuminate\Console\Command->run() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/symfony/console/Application.php:1014
 Symfony\Component\Console\Application->doRunCommand() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/illuminate/console/Application.php:102
 Illuminate\Console\Application->run() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/laravel-zero/foundation/src/Illuminate/Foundation/Console/Kernel.php:155
 Illuminate\Foundation\Console\Kernel->handle() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/vendor/laravel-zero/framework/src/Kernel.php:96
 LaravelZero\Framework\Kernel->handle() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/app/DusterKernel.php:19
 App\DusterKernel->handle() at phar:///Users/ben/hubventory/vendor/tightenco/duster/builds/duster/duster:34
 require() at /Users/ben/hubventory/vendor/tightenco/duster/builds/duster:14
 include() at /Users/ben/hubventory/vendor/bin/duster:120

husky - pre-commit hook exited with code 1 (error)