Generate Better Index Keys (#3826)

* Generate Better Index Keys

* More Robust index mapping

* Remove unused import

* Remove unused import

---------

Co-authored-by: Terrance DeJesus <99630311+terrancedejesus@users.noreply.github.com>
Co-authored-by: Mika Ayenson <Mikaayenson@users.noreply.github.com>

(cherry picked from commit 949ceccc0f)
This commit is contained in:
shashank-elastic
2024-06-28 23:18:09 +05:30
committed by github-actions[bot]
parent 408442e185
commit 28f67e3ace
+2 -4
View File
@@ -246,7 +246,6 @@ class Package(object):
def generate_summary_and_changelog(self, changed_rule_ids, new_rule_ids, removed_rules):
"""Generate stats on package."""
from string import ascii_lowercase, ascii_uppercase
summary = {
'changed': defaultdict(list),
@@ -261,7 +260,7 @@ class Package(object):
'unchanged': defaultdict(list)
}
# build an index map first
# Build an index map first
longest_name = 0
indexes = set()
for rule in self.rules:
@@ -270,8 +269,7 @@ class Package(object):
if index_list:
indexes.update(index_list)
letters = ascii_uppercase + ascii_lowercase
index_map = {index: letters[i] for i, index in enumerate(sorted(indexes))}
index_map = {index: str(i) for i, index in enumerate(sorted(indexes))}
def get_summary_rule_info(r: TOMLRule):
r = r.contents