From cc6d271f1003d46d50d20b26cff0192a3bff30ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Sibiril?= <81782+aureliensibiril@users.noreply.github.com> Date: Fri, 10 Apr 2026 10:12:44 +0200 Subject: [PATCH] Remove unused ScopesCover function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com> --- pkg/connector/scopes.go | 18 ------------------ pkg/connector/scopes_test.go | 24 ------------------------ 2 files changed, 42 deletions(-) diff --git a/pkg/connector/scopes.go b/pkg/connector/scopes.go index a70325a3d..3ad8a4a91 100644 --- a/pkg/connector/scopes.go +++ b/pkg/connector/scopes.go @@ -76,21 +76,3 @@ func UnionScopes(scopeSets ...[]string) []string { sort.Strings(out) return out } - -// ScopesCover reports whether `granted` already contains every scope in -// `required`. An empty `required` set is trivially covered. -func ScopesCover(granted, required []string) bool { - if len(required) == 0 { - return true - } - grantedSet := make(map[string]struct{}, len(granted)) - for _, s := range granted { - grantedSet[s] = struct{}{} - } - for _, r := range required { - if _, ok := grantedSet[r]; !ok { - return false - } - } - return true -} diff --git a/pkg/connector/scopes_test.go b/pkg/connector/scopes_test.go index fe60ba966..822557aa8 100644 --- a/pkg/connector/scopes_test.go +++ b/pkg/connector/scopes_test.go @@ -72,30 +72,6 @@ func TestUnionScopes(t *testing.T) { } } -func TestScopesCover(t *testing.T) { - t.Parallel() - - cases := []struct { - name string - granted []string - required []string - want bool - }{ - {"empty required is covered", []string{"a"}, []string{}, true}, - {"empty granted does not cover non-empty required", []string{}, []string{"a"}, false}, - {"exact match", []string{"a", "b"}, []string{"a", "b"}, true}, - {"granted superset", []string{"a", "b", "c"}, []string{"a", "b"}, true}, - {"missing one", []string{"a"}, []string{"a", "b"}, false}, - {"reordered match", []string{"b", "a"}, []string{"a", "b"}, true}, - } - for _, c := range cases { - t.Run(c.name, func(t *testing.T) { - t.Parallel() - assert.Equal(t, c.want, ScopesCover(c.granted, c.required)) - }) - } -} - func TestFormatScopeString(t *testing.T) { t.Parallel()