From 15b3d98ce1ce69fab3e10a9740f6c94f3a56f134 Mon Sep 17 00:00:00 2001 From: Imani Manyara Date: Wed, 16 Sep 2026 12:38:42 -0400 Subject: [PATCH] Lint with the shared Pint config, and stop moving action pins backwards **Style.** `vendor/bin/laranail-pint` resolves the one config in vendor/laranail/package-tools and errors when it is absent. Bare `vendor/bin/pint` takes a `--config` path that does not exist, silently falls back to its own defaults and exits 0 -- so twelve workflows in this family were reporting "code style clean" against a rule set no other package uses. Those now call laranail-pint, and this is what the shared config actually wanted: import order, `.` spacing, `=>` alignment, brace position, single-line empty bodies, phpdoc alignment. No behaviour changes; the suites are unchanged and green. **Pins.** The release.yml consistency pass had copied one repo's pins over fourteen others, and that repo was behind: `softprops/action-gh-release` went v3.0.3 -> v3.0.2 (v3.0.3 -> v2 in enumerator) and `anchore/sbom-action` went v0.24.2 -> v0.24.0. Pinning to a SHA is a supply-chain control, so a pin moving backwards is the one direction that must never happen by accident -- and nothing catches it, because the pin check verifies the SHA against its comment, not that the version moved forward. Both are on one pin family-wide now, at the newest release, with the exact release tag in the comment rather than a moving major. **And the alias debris.** Where the `$commandAliases` declarations were deleted, this also fixes the two command bases that read `$this->commandAliases` without declaring it (an `Undefined property` at construction, which took out `artisan package:discover`), a command that called a sibling by its deleted alias, a success message naming a command that no longer exists, and the docs that still documented the aliases as the way in. --- .github/workflows/static-analysis.yml | 6 +++- config/config.php | 34 +++++++++---------- src/Commands/InstallCommand.php | 14 ++++---- src/Commands/PreCommitHookCommand.php | 9 ++--- .../GitCommitCheckerServiceProvider.php | 8 ++--- tests/Feature/NamingConventionTest.php | 2 +- 6 files changed, 39 insertions(+), 34 deletions(-) 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.