diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index a802b84..28f3f34 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -45,4 +45,8 @@ jobs: run: rm -rf "$(composer config cache-files-dir)/laranail" - run: composer update --prefer-dist --no-interaction - - run: vendor/bin/pint --test + # laranail-pint, not bare pint: it resolves the ONE shared config in + # vendor/laranail/package-tools and errors if it is absent. Bare `pint` + # silently falls back to its own defaults and exits 0, so this step was + # reporting "clean" against a rule set no other package here uses. + - run: vendor/bin/laranail-pint --test diff --git a/config/config.php b/config/config.php index 655e7c9..48e499f 100644 --- a/config/config.php +++ b/config/config.php @@ -13,18 +13,18 @@ 'pint' => [ 'presets' => [ - 'laravel' => 'Laravel (Default)', - 'symfony' => 'Symfony', - 'psr12' => 'PSR-12', + 'laravel' => 'Laravel (Default)', + 'symfony' => 'Symfony', + 'psr12' => 'PSR-12', 'recommended' => 'Recommended (PSR-12 Extended)', ], 'recommended_preset' => [ 'preset' => 'psr12', - 'rules' => [ - 'array_syntax' => ['syntax' => 'short'], + 'rules' => [ + 'array_syntax' => ['syntax' => 'short'], 'binary_operator_spaces' => [ - 'default' => 'single_space', + 'default' => 'single_space', 'operators' => [ '=' => null, ], @@ -35,18 +35,18 @@ 'concat_space' => [ 'spacing' => 'one', ], - 'function_typehint_space' => true, - 'native_function_casing' => true, - 'no_extra_blank_lines' => true, - 'no_leading_namespace_whitespace' => true, - 'no_spaces_around_offset' => true, - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => true, + 'function_typehint_space' => true, + 'native_function_casing' => true, + 'no_extra_blank_lines' => true, + 'no_leading_namespace_whitespace' => true, + 'no_spaces_around_offset' => true, + 'no_unused_imports' => true, + 'not_operator_with_successor_space' => true, 'object_operator_without_whitespace' => true, - 'single_quote' => true, - 'trailing_comma_in_multiline' => true, - 'unary_operator_spaces' => true, - 'whitespace_after_comma_in_array' => true, + 'single_quote' => true, + 'trailing_comma_in_multiline' => true, + 'unary_operator_spaces' => true, + 'whitespace_after_comma_in_array' => true, ], ], ], diff --git a/src/Commands/InstallCommand.php b/src/Commands/InstallCommand.php index 7c1ac85..2e22754 100644 --- a/src/Commands/InstallCommand.php +++ b/src/Commands/InstallCommand.php @@ -4,11 +4,11 @@ namespace Simtabi\Laranail\GitCommitChecker\Commands; -use Illuminate\Console\Application; use Illuminate\Console\Command; +use Illuminate\Console\Application; use Illuminate\Console\ConfirmableTrait; -use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Attribute\AsCommand; #[AsCommand('git-commit-checker:install', 'Install "pre_commit" hook into your git.')] class InstallCommand extends Command @@ -62,18 +62,18 @@ protected function install(string $hook, string $class): bool $command = new $class; if ($command instanceof Command === false) { - $this->components->error("Class [$class] is not instance of ".Command::class.'.'); + $this->components->error("Class [$class] is not instance of " . Command::class . '.'); abort(1); } $script = $this->generateHookScript($command->getName()); - $path = $this->laravel->basePath('.git/hooks/'.$hook); + $path = $this->laravel->basePath('.git/hooks/' . $hook); $relativePath = ltrim(str_replace($this->laravel->basePath(), '', $path), DIRECTORY_SEPARATOR); if ( $this->laravel['files']->exists($path) && - ! $this->confirmToProceed($relativePath.' already exists, do you want to overwrite it?', true) + ! $this->confirmToProceed($relativePath . ' already exists, do you want to overwrite it?', true) ) { return false; } @@ -106,9 +106,9 @@ protected function generatePintConfiguration(string $path): void ? ['preset' => $preset] : $this->laravel['config']->get('git-commit-checker.pint.recommended_preset'), JSON_PRETTY_PRINT, - ).PHP_EOL, + ) . PHP_EOL, )) { - $this->components->error('Unable to write '.$path); + $this->components->error('Unable to write ' . $path); abort(1); } diff --git a/src/Commands/PreCommitHookCommand.php b/src/Commands/PreCommitHookCommand.php index 1aa392e..9ad23cc 100644 --- a/src/Commands/PreCommitHookCommand.php +++ b/src/Commands/PreCommitHookCommand.php @@ -4,13 +4,14 @@ namespace Simtabi\Laranail\GitCommitChecker\Commands; -use Illuminate\Console\Command; use Illuminate\Support\Str; -use Symfony\Component\Console\Attribute\AsCommand; -use Symfony\Component\Process\Process; use function Termwind\render; +use Illuminate\Console\Command; +use Symfony\Component\Process\Process; +use Symfony\Component\Console\Attribute\AsCommand; + #[AsCommand('git-commit-checker:pre-commit-hook', 'Git hook before commit')] class PreCommitHookCommand extends Command { @@ -50,7 +51,7 @@ public function handle(): int render( view('laranail/git-commit-checker::summary', [ - 'result' => $result, + 'result' => $result, 'isSuccessful' => $process->isSuccessful(), ]), ); diff --git a/src/Providers/GitCommitCheckerServiceProvider.php b/src/Providers/GitCommitCheckerServiceProvider.php index c9187e6..7b5b27c 100644 --- a/src/Providers/GitCommitCheckerServiceProvider.php +++ b/src/Providers/GitCommitCheckerServiceProvider.php @@ -10,22 +10,22 @@ class GitCommitCheckerServiceProvider extends ServiceProvider { public function register(): void { - $this->mergeConfigFrom(__DIR__.'/../../config/config.php', 'laranail.git-commit-checker'); + $this->mergeConfigFrom(__DIR__ . '/../../config/config.php', 'laranail.git-commit-checker'); } public function boot() { $this->app->register(CommandServiceProvider::class); - $this->loadViewsFrom(__DIR__.'/../../resources/views', 'laranail/git-commit-checker'); + $this->loadViewsFrom(__DIR__ . '/../../resources/views', 'laranail/git-commit-checker'); if ($this->app->runningInConsole()) { $this->publishes([ - __DIR__.'/../../config/config.php' => config_path('git-commit-checker.php'), + __DIR__ . '/../../config/config.php' => config_path('git-commit-checker.php'), ], 'laranail::git-commit-checker-config'); $this->publishes([ - __DIR__.'/../../resources/views' => resource_path('views/vendor/laranail/git-commit-checker'), + __DIR__ . '/../../resources/views' => resource_path('views/vendor/laranail/git-commit-checker'), ], 'laranail::git-commit-checker-views'); } } diff --git a/tests/Feature/NamingConventionTest.php b/tests/Feature/NamingConventionTest.php index f5cdbad..c97aa2f 100644 --- a/tests/Feature/NamingConventionTest.php +++ b/tests/Feature/NamingConventionTest.php @@ -2,8 +2,8 @@ declare(strict_types=1); -use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\View; +use Illuminate\Support\Facades\Config; /** * Every name this package registers into a framework-owned registry.