Skip to content

Commit 3907230

Browse files
committed
🟢 feedback
1 parent 2f73d67 commit 3907230

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

providers/core/resources/unicode.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import (
1313
"go.mondoo.com/mql/v13/providers/core/resources/classifier"
1414
)
1515

16-
func hash(input string) string {
16+
func unicodeInputHash(input string) string {
1717
h := sha256.New()
1818
h.Write([]byte(input))
1919
bs := h.Sum(nil)
2020
return base64.StdEncoding.EncodeToString(bs)
2121
}
2222

2323
func (r *mqlUnicode) id() (string, error) {
24-
return "unicode/" + hash(r.Input.Data), nil
24+
return "unicode/" + unicodeInputHash(r.Input.Data), nil
2525
}
2626

2727
func (r *mqlUnicode) classification() ([]interface{}, error) {
@@ -33,15 +33,15 @@ func (r *mqlUnicode) classification() ([]interface{}, error) {
3333
return nil, err
3434
}
3535

36-
id := hash(r.Input.Data)
36+
id := unicodeInputHash(r.Input.Data)
3737

3838
res := []any{}
3939
for i := range characterInfo {
40-
r, err := newMqlCharacterInfo(r.MqlRuntime, id, characterInfo[i])
40+
ci, err := newMqlCharacterInfo(r.MqlRuntime, id, characterInfo[i])
4141
if err != nil {
4242
return nil, err
4343
}
44-
res = append(res, r)
44+
res = append(res, ci)
4545
}
4646

4747
return res, nil
@@ -73,7 +73,7 @@ func (r *mqlUnicode) categories() ([]any, error) {
7373
return nil, err
7474
}
7575

76-
id := hash(r.Input.Data)
76+
id := unicodeInputHash(r.Input.Data)
7777

7878
res := []any{}
7979
for k, v := range summary {
@@ -82,6 +82,7 @@ func (r *mqlUnicode) categories() ([]any, error) {
8282
"__id": llx.StringData(id + "/" + k),
8383
"category": llx.StringData(k),
8484
"majorCategory": llx.StringData(string(k[0])),
85+
"description": llx.StringData(classifier.CategoryDescriptions[k]),
8586
"count": llx.IntData(v),
8687
})
8788
if err != nil {

0 commit comments

Comments
 (0)