diff --git a/.gitattributes b/.gitattributes index a212694b..73c4f136 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,7 +12,6 @@ .editorconfig export-ignore .gitattributes export-ignore .gitignore export-ignore -.styleci.yml export-ignore CHANGELOG.md export-ignore phpunit.xml.dist export-ignore UPGRADE.md export-ignore diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml new file mode 100644 index 00000000..0d0a5890 --- /dev/null +++ b/.github/workflows/coding-standards.yml @@ -0,0 +1,7 @@ +name: fix code styling + +on: [push] + +jobs: + lint: + uses: laravel/.github/.github/workflows/coding-standards.yml@main diff --git a/config/pulse.php b/config/pulse.php index ba6e9a4d..17a05f92 100644 --- a/config/pulse.php +++ b/config/pulse.php @@ -5,7 +5,7 @@ 'path' => env('PULSE_PATH', 'pulse'), 'middleware' => [ - 'web' + 'web', ], // The name that will appear in the dashboard after running the `pulse:check` command. diff --git a/src/Pulse.php b/src/Pulse.php index dc404006..ee8245bb 100644 --- a/src/Pulse.php +++ b/src/Pulse.php @@ -22,7 +22,7 @@ public function servers() 'cpu' => (int) $server['cpu'], 'memory_used' => (int) $server['memory_used'], 'memory_total' => (int) $server['memory_total'], - 'storage' => json_decode($server['storage']) + 'storage' => json_decode($server['storage']), ]) ->values(); @@ -44,7 +44,7 @@ public function userRequestCounts() RedisAdapter::zunionstore( 'pulse_user_request_counts:7-day', collect(range(0, 6)) - ->map(fn ($days) => 'pulse_user_request_counts:' . now()->subDays($days)->format('Y-m-d')) + ->map(fn ($days) => 'pulse_user_request_counts:'.now()->subDays($days)->format('Y-m-d')) ->toArray() ); @@ -72,25 +72,25 @@ public function slowEndpoints() RedisAdapter::zunionstore( 'pulse_slow_endpoint_request_counts:7-day', collect(range(0, 6)) - ->map(fn ($days) => 'pulse_slow_endpoint_request_counts:' . now()->subDays($days)->format('Y-m-d')) + ->map(fn ($days) => 'pulse_slow_endpoint_request_counts:'.now()->subDays($days)->format('Y-m-d')) ->toArray(), - 'SUM' + 'SUM' ); RedisAdapter::zunionstore( 'pulse_slow_endpoint_total_durations:7-day', collect(range(0, 6)) - ->map(fn ($days) => 'pulse_slow_endpoint_total_durations:' . now()->subDays($days)->format('Y-m-d')) + ->map(fn ($days) => 'pulse_slow_endpoint_total_durations:'.now()->subDays($days)->format('Y-m-d')) ->toArray(), - 'SUM' + 'SUM' ); RedisAdapter::zunionstore( 'pulse_slow_endpoint_slowest_durations:7-day', collect(range(0, 6)) - ->map(fn ($days) => 'pulse_slow_endpoint_slowest_durations:' . now()->subDays($days)->format('Y-m-d')) + ->map(fn ($days) => 'pulse_slow_endpoint_slowest_durations:'.now()->subDays($days)->format('Y-m-d')) ->toArray(), - 'MAX' + 'MAX' ); $requestCounts = RedisAdapter::zrevrange('pulse_slow_endpoint_request_counts:7-day', 0, -1, true); @@ -119,9 +119,9 @@ public function usersExperiencingSlowEndpoints() RedisAdapter::zunionstore( 'pulse_slow_endpoint_user_counts:7-day', collect(range(0, 6)) - ->map(fn ($days) => 'pulse_slow_endpoint_user_counts:' . now()->subDays($days)->format('Y-m-d')) + ->map(fn ($days) => 'pulse_slow_endpoint_user_counts:'.now()->subDays($days)->format('Y-m-d')) ->toArray(), - 'SUM' + 'SUM' ); $userCounts = collect(RedisAdapter::zrevrange('pulse_slow_endpoint_user_counts:7-day', 0, -1, true)); @@ -148,25 +148,25 @@ public function slowQueries() RedisAdapter::zunionstore( 'pulse_slow_query_execution_counts:7-day', collect(range(0, 6)) - ->map(fn ($days) => 'pulse_slow_query_execution_counts:' . now()->subDays($days)->format('Y-m-d')) + ->map(fn ($days) => 'pulse_slow_query_execution_counts:'.now()->subDays($days)->format('Y-m-d')) ->toArray(), - 'SUM' + 'SUM' ); RedisAdapter::zunionstore( 'pulse_slow_query_total_durations:7-day', collect(range(0, 6)) - ->map(fn ($days) => 'pulse_slow_query_total_durations:' . now()->subDays($days)->format('Y-m-d')) + ->map(fn ($days) => 'pulse_slow_query_total_durations:'.now()->subDays($days)->format('Y-m-d')) ->toArray(), - 'SUM' + 'SUM' ); RedisAdapter::zunionstore( 'pulse_slow_query_slowest_durations:7-day', collect(range(0, 6)) - ->map(fn ($days) => 'pulse_slow_query_slowest_durations:' . now()->subDays($days)->format('Y-m-d')) + ->map(fn ($days) => 'pulse_slow_query_slowest_durations:'.now()->subDays($days)->format('Y-m-d')) ->toArray(), - 'MAX' + 'MAX' ); $executionCounts = RedisAdapter::zrevrange('pulse_slow_query_execution_counts:7-day', 0, -1, true); @@ -175,7 +175,6 @@ public function slowQueries() return collect($executionCounts) ->map(function ($executionCount, $sql) use ($totalDurations, $slowestDurations) { - return [ 'sql' => $sql, 'execution_count' => (int) $executionCount, @@ -189,11 +188,11 @@ public function slowQueries() public function cacheStats() { $hits = collect(range(0, 6)) - ->map(fn ($days) => RedisAdapter::get('pulse_cache_hits:' . now()->subDays($days)->format('Y-m-d'))) + ->map(fn ($days) => RedisAdapter::get('pulse_cache_hits:'.now()->subDays($days)->format('Y-m-d'))) ->sum(); $misses = collect(range(0, 6)) - ->map(fn ($days) => RedisAdapter::get('pulse_cache_misses:' . now()->subDays($days)->format('Y-m-d'))) + ->map(fn ($days) => RedisAdapter::get('pulse_cache_misses:'.now()->subDays($days)->format('Y-m-d'))) ->sum(); $total = $hits + $misses; @@ -216,17 +215,17 @@ public function exceptions() RedisAdapter::zunionstore( 'pulse_exception_counts:7-day', collect(range(0, 6)) - ->map(fn ($days) => 'pulse_exception_counts:' . now()->subDays($days)->format('Y-m-d')) + ->map(fn ($days) => 'pulse_exception_counts:'.now()->subDays($days)->format('Y-m-d')) ->toArray(), - 'SUM' + 'SUM' ); RedisAdapter::zunionstore( 'pulse_exception_last_occurrences:7-day', collect(range(0, 6)) - ->map(fn ($days) => 'pulse_exception_last_occurrences:' . now()->subDays($days)->format('Y-m-d')) + ->map(fn ($days) => 'pulse_exception_last_occurrences:'.now()->subDays($days)->format('Y-m-d')) ->toArray(), - 'MAX' + 'MAX' ); $exceptionCounts = RedisAdapter::zrevrange('pulse_exception_counts:7-day', 0, -1, true); diff --git a/src/PulseServiceProvider.php b/src/PulseServiceProvider.php index 4d056879..9b1321fc 100644 --- a/src/PulseServiceProvider.php +++ b/src/PulseServiceProvider.php @@ -12,7 +12,6 @@ use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; -use Laravel\Pulse\View\Components\Pulse as PulseComponent; use Laravel\Pulse\Commands\CheckCommand; use Laravel\Pulse\Contracts\ShouldNotReportUsage; use Laravel\Pulse\Handlers\HandleCacheHit; @@ -28,6 +27,7 @@ use Laravel\Pulse\Http\Livewire\SlowEndpoints; use Laravel\Pulse\Http\Livewire\SlowQueries; use Laravel\Pulse\Http\Livewire\Usage; +use Laravel\Pulse\View\Components\Pulse as PulseComponent; use Livewire\Livewire; use Throwable;