From 74a4ae19eea38d4cb61686ee3e65cee79b30f6f5 Mon Sep 17 00:00:00 2001 From: harsh mahajan Date: Tue, 19 May 2026 11:28:04 +0530 Subject: [PATCH] refactor: remove unnecessary comments Co-Authored-By: Claude Sonnet 4.6 --- .../Modules/VCS/Http/GitHub/Authorize/External/Update.php | 2 +- .../Platform/Modules/VCS/Http/GitHub/Events/Create.php | 2 +- src/Appwrite/Vcs/Validator/BuildTrigger.php | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/External/Update.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/External/Update.php index fed7248ddf..86ac0899d1 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/External/Update.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Authorize/External/Update.php @@ -133,7 +133,7 @@ class Update extends Action $prFiles = $github->getPullRequestFiles($owner, $providerRepositoryName, $providerPullRequestId); $providerAffectedFiles = [ ...array_column($prFiles, 'filename'), - ...array_filter(array_column($prFiles, 'previous_filename')) // Filter out null values + ...array_filter(array_column($prFiles, 'previous_filename')) ]; $this->createGitDeployments($github, $providerInstallationId, $repositories, $providerBranch, $providerBranchUrl, $providerRepositoryName, $providerRepositoryUrl, $providerRepositoryOwner, $providerCommitHash, $providerCommitAuthor, $providerCommitAuthorUrl, $providerCommitMessage, $providerCommitUrl, $providerPullRequestId, $providerAffectedFiles, true, $dbForPlatform, $authorization, $publisherForBuilds, $getProjectDB, $platform); diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php index fd8a48ac15..7ce9ece505 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Events/Create.php @@ -215,7 +215,7 @@ class Create extends Action $prFiles = $github->getPullRequestFiles($providerRepositoryOwner, $providerRepositoryName, $providerPullRequestId); $providerAffectedFiles = [ ...array_column($prFiles, 'filename'), - ...array_filter(array_column($prFiles, 'previous_filename')) // Filter out null values + ...array_filter(array_column($prFiles, 'previous_filename')) ]; $repositories = $authorization->skip(fn () => $dbForPlatform->find('repositories', [ diff --git a/src/Appwrite/Vcs/Validator/BuildTrigger.php b/src/Appwrite/Vcs/Validator/BuildTrigger.php index 22037c8907..be8b9c43d1 100644 --- a/src/Appwrite/Vcs/Validator/BuildTrigger.php +++ b/src/Appwrite/Vcs/Validator/BuildTrigger.php @@ -24,7 +24,6 @@ class BuildTrigger extends Validator $exclude = array_filter($this->patterns, fn ($p) => str_starts_with($p, '!')); if (empty($include)) { - // Only exclusions: pass everything unless excluded. foreach ($exclude as $pattern) { if ($this->matchGlob($value, substr($pattern, 1))) { return false; @@ -33,31 +32,26 @@ class BuildTrigger extends Validator return true; } - // A pattern is "specific" when it contains no wildcard characters. $isSpecific = fn ($pattern) => !str_contains($pattern, '*') && !str_contains($pattern, '?'); - // 1. Specific inclusion always wins — an explicit exact match is never blocked. foreach ($include as $pattern) { if ($isSpecific($pattern) && $this->matchGlob($value, $pattern)) { return true; } } - // 2. Any exclusion (specific or wildcard) overrides a wildcard inclusion — refines broad patterns. foreach ($exclude as $pattern) { if ($this->matchGlob($value, substr($pattern, 1))) { return false; } } - // 3. Wildcard inclusion — no exclusion blocked it. foreach ($include as $pattern) { if (!$isSpecific($pattern) && $this->matchGlob($value, $pattern)) { return true; } } - // No inclusion matched. return false; }