Skip to content

Commit 01c9bcb

Browse files
renamed
1 parent adabb36 commit 01c9bcb

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

tools/cli/internal/changelog/outputfilter/squash.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ func squashEntries(entries []*OasDiffEntry) ([]*OasDiffEntry, error) {
147147
entriesByIDandOperationID, hiddenEntriesByIDandOperationID := newEntriesMapPerIDAndOperationID(entries)
148148

149149
squashHandlers := newSquashHandlers()
150-
squashedEntries := []*OasDiffEntry{}
150+
squashedEntriesOut := []*OasDiffEntry{}
151151

152152
for _, entry := range entries {
153153
// if no squash handlers implemented for entry's code,
154154
// just append the entry to the result
155155
if _, ok := findHandler(entry.ID); !ok {
156-
squashedEntries = append(squashedEntries, entry)
156+
squashedEntriesOut = append(squashedEntriesOut, entry)
157157
continue
158158
}
159159
}
@@ -168,14 +168,14 @@ func squashEntries(entries []*OasDiffEntry) ([]*OasDiffEntry, error) {
168168
return nil, err
169169
}
170170

171-
squashedEntries = append(squashedEntries, squashedEntriesNotHidden...)
172-
squashedEntries = append(squashedEntries, squashedEntriesHidden...)
171+
squashedEntriesOut = append(squashedEntriesOut, squashedEntriesNotHidden...)
172+
squashedEntriesOut = append(squashedEntriesOut, squashedEntriesHidden...)
173173

174-
return squashedEntries, nil
174+
return squashedEntriesOut, nil
175175
}
176176

177177
func applySquashHandlerToMap(squashHandlers []handler, entriesMap map[string]map[string][]*OasDiffEntry) ([]*OasDiffEntry, error) {
178-
squashedEntries := []*OasDiffEntry{}
178+
squashedEntriesOut := []*OasDiffEntry{}
179179
for _, handler := range squashHandlers {
180180
entryMapPerOperationID, ok := entriesMap[handler.id]
181181
if !ok {
@@ -187,9 +187,9 @@ func applySquashHandlerToMap(squashHandlers []handler, entriesMap map[string]map
187187
return nil, err
188188
}
189189

190-
squashedEntries = append(squashedEntries, sortEntriesByDescription(entries)...)
190+
squashedEntriesOut = append(squashedEntriesOut, sortEntriesByDescription(entries)...)
191191
}
192-
return squashedEntries, nil
192+
return squashedEntriesOut, nil
193193
}
194194

195195
func sortEntriesByDescription(entries []*OasDiffEntry) []*OasDiffEntry {
@@ -209,7 +209,7 @@ func findHandler(id string) (*handler, bool) {
209209
return nil, false
210210
}
211211

212-
type valuesToSquashStruct struct {
212+
type squashedEntries struct {
213213
valuesNotSquashed []string
214214
valuesToSquash map[string]struct{}
215215
}
@@ -304,13 +304,13 @@ func replaceOnlyFirstOccurrence(template, valuesToAddToTemplate string) string {
304304
})
305305
}
306306

307-
func newSquashMap(operation string, entries []*OasDiffEntry, expectedNumberOfValues, squashIdx int) (map[string]valuesToSquashStruct, error) {
307+
func newSquashMap(operation string, entries []*OasDiffEntry, expectedNumberOfValues, squashIdx int) (map[string]squashedEntries, error) {
308308
// squash_map is a dictionary where:
309309
// The key is a string generated by concatenating values extracted from each entry, excluding the one at squash_idx (the index to be squashed).
310310
// The value is a tuple:
311311
// - The first element is a list of the values that are not squashed. Example: [regionName, 200]
312312
// - The second element is a set of values that should be squashed. Example: ("GLOBAL_EVENT_ADMIN", "ORG_MEMBER")
313-
squashMap := map[string]valuesToSquashStruct{}
313+
squashMap := map[string]squashedEntries{}
314314

315315
for _, entry := range entries {
316316
values, err := extractExactValuesOrFail(operation, entry, expectedNumberOfValues)
@@ -322,7 +322,7 @@ func newSquashMap(operation string, entries []*OasDiffEntry, expectedNumberOfVal
322322

323323
mergedKey := strings.Join(values, "|")
324324
if _, exists := squashMap[mergedKey]; !exists {
325-
squashMap[mergedKey] = valuesToSquashStruct{
325+
squashMap[mergedKey] = squashedEntries{
326326
valuesNotSquashed: values,
327327
valuesToSquash: make(map[string]struct{}),
328328
}

tools/cli/internal/changelog/outputfilter/squash_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func TestNewSquashMap(t *testing.T) {
235235
entries []*OasDiffEntry
236236
expectedNumberOfValues int
237237
squashIdx int
238-
want map[string]valuesToSquashStruct
238+
want map[string]squashedEntries
239239
wantErr require.ErrorAssertionFunc
240240
}{
241241
{
@@ -244,7 +244,7 @@ func TestNewSquashMap(t *testing.T) {
244244
entries: []*OasDiffEntry{},
245245
expectedNumberOfValues: 0,
246246
squashIdx: 0,
247-
want: map[string]valuesToSquashStruct{},
247+
want: map[string]squashedEntries{},
248248
wantErr: require.NoError,
249249
},
250250
{
@@ -255,7 +255,7 @@ func TestNewSquashMap(t *testing.T) {
255255
},
256256
expectedNumberOfValues: 1,
257257
squashIdx: 0,
258-
want: map[string]valuesToSquashStruct{
258+
want: map[string]squashedEntries{
259259
"": {
260260
valuesNotSquashed: []string{""},
261261
valuesToSquash: map[string]struct{}{"test": {}},
@@ -273,7 +273,7 @@ func TestNewSquashMap(t *testing.T) {
273273
},
274274
expectedNumberOfValues: 1,
275275
squashIdx: 0,
276-
want: map[string]valuesToSquashStruct{
276+
want: map[string]squashedEntries{
277277
"": {
278278
valuesNotSquashed: []string{""},
279279
valuesToSquash: map[string]struct{}{"test1": {}, "test2": {}, "test3": {}},

0 commit comments

Comments
 (0)