Skip to content

Commit ea7bbfc

Browse files
committed
Accept some suggestions
1 parent fe408b0 commit ea7bbfc

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

policy/predicate/custom_properties.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package predicate
1717
import (
1818
"context"
1919
"fmt"
20+
"maps"
2021
"slices"
2122
"strings"
2223

@@ -37,11 +38,7 @@ var _ Predicate = (CustomPropertyMatchesNoneOf)(nil)
3738

3839
func formatCustomProperties(customProperties map[string]pull.CustomProperty) []string {
3940
result := []string{}
40-
keys := make([]string, 0, len(customProperties))
41-
for k := range customProperties {
42-
keys = append(keys, k)
43-
}
44-
slices.Sort(keys)
41+
keys := slices.Sorted(maps.Keys(customProperties))
4542
for _, k := range keys {
4643
v := customProperties[k]
4744
formatted := "(null)"
@@ -121,9 +118,9 @@ func (pred CustomPropertyMatchesAnyOf) Evaluate(ctx context.Context, prctx pull.
121118
}
122119

123120
predicateResult := common.PredicateResult{
124-
ValuePhrase: "specified custom properties",
121+
ValuePhrase: "custom properties",
125122
Values: formatCustomProperties(customProperties),
126-
ConditionPhrase: "match one or more of the specified values",
123+
ConditionPhrase: "match one or more of the patterns",
127124
ConditionsMap: conditionsMap,
128125
Satisfied: true,
129126
}
@@ -160,10 +157,10 @@ func (pred CustomPropertyMatchesNoneOf) Evaluate(ctx context.Context, prctx pull
160157
}
161158

162159
predicateResult := common.PredicateResult{
163-
ValuePhrase: "specified custom properties",
160+
ValuePhrase: "custom properties",
164161
Values: formatCustomProperties(customProperties),
165162
ReverseSkipPhrase: true,
166-
ConditionPhrase: "match one or more of the specified values",
163+
ConditionPhrase: "match one or more of the patterns",
167164
ConditionsMap: conditionsMap,
168165
Satisfied: true,
169166
}

0 commit comments

Comments
 (0)