Skip to content

Commit

Permalink
chore: pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gotbadger committed Nov 20, 2023
1 parent fa9e0fc commit 41390f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
18 changes: 7 additions & 11 deletions internal/commands/ignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,17 @@ $ bearer ignore show <fingerprint>`,
cmd.Print("\n")
if options.IgnoreShowOptions.All {
// show all fingerprints sorted by date
var sortedIgnoredItems []ignoretypes.SortedIgnoredFingerpint

for fingerprintId, fingerprint := range ignoredFingerprints {
sortedIgnoredItems = append(sortedIgnoredItems, ignoretypes.SortedIgnoredFingerpint{
FingerprintId: fingerprintId,
IgnoredFingerprint: fingerprint,
})
keys := make([]string, 0, len(ignoredFingerprints))
for key := range ignoredFingerprints {
keys = append(keys, key)
}

sort.Slice(sortedIgnoredItems, func(i, j int) bool {
return sortedIgnoredItems[i].IgnoredFingerprint.IgnoredAt < sortedIgnoredItems[j].IgnoredFingerprint.IgnoredAt
sort.SliceStable(keys, func(i, j int) bool {
return ignoredFingerprints[keys[i]].IgnoredAt < ignoredFingerprints[keys[j]].IgnoredAt
})

for _, data := range sortedIgnoredItems {
cmd.Print(ignore.DisplayIgnoredEntryTextString(data.FingerprintId, data.IgnoredFingerprint, options.GeneralOptions.NoColor))
for _, k := range keys {
cmd.Print(ignore.DisplayIgnoredEntryTextString(k, ignoredFingerprints[k], options.GeneralOptions.NoColor))
cmd.Print("\n\n")
}
} else {
Expand Down
5 changes: 0 additions & 5 deletions internal/util/ignore/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ type IgnoredFingerprint struct {
FalsePositive bool `json:"false_positive"`
IgnoredAt string `json:"ignored_at"`
}

type SortedIgnoredFingerpint struct {
FingerprintId string
IgnoredFingerprint IgnoredFingerprint
}

0 comments on commit 41390f2

Please sign in to comment.