From 8e2586a070f89e2132b07d3ac6877bb4fbe7fc3e Mon Sep 17 00:00:00 2001 From: Liam Galvin Date: Thu, 13 Jan 2022 14:03:12 +0000 Subject: [PATCH] Update rule.go --- rules/rule.go | 57 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/rules/rule.go b/rules/rule.go index e91cd7d4f..a424cc7dd 100755 --- a/rules/rule.go +++ b/rules/rule.go @@ -44,23 +44,55 @@ func (r Rule) ShortCodeDisplayName() string { } var acronyms = []string{ + "acl", + "alb", + "api", + "arn", "aws", + "cidr", + "db", + "dns", + "ebs", "ec2", "ecr", - "eks", + "ecs", "efs", - "kms", - "https", - "ssh", + "eks", + "elb", + "gke", "http", + "http2", + "https", + "iam", + "im", + "imds", + "ip", + "ips", + "kms", + "lb", + "md5", + "mfa", "mq", + "msk", + "rbac", + "rdp", + "rds", + "rsa", + "sam", + "sgr", + "sha1", + "sha256", "sns", + "sql", "sqs", - "iam", - "alb", - "lb", - "elb", + "ssh", + "ssm", "tls", + "ubla", + "vm", + "vpc", + "vtpm", + "waf", } var specials = map[string]string{ @@ -68,15 +100,18 @@ var specials = map[string]string{ "documentdb": "DocumentDB", "mysql": "MySQL", "postgresql": "PostgreSQL", + "acls": "ACLs", + "ips": "IPs", + "bigquery": "BigQuery", } func nicify(input string) string { input = strings.ToLower(input) - for _, acronym := range acronyms { - input = regexp.MustCompile(fmt.Sprintf("\\b%s\\b", acronym)).ReplaceAllString(input, strings.ToUpper(acronym)) - } for replace, with := range specials { input = regexp.MustCompile(fmt.Sprintf("\\b%s\\b", replace)).ReplaceAllString(input, with) } + for _, acronym := range acronyms { + input = regexp.MustCompile(fmt.Sprintf("\\b%s\\b", acronym)).ReplaceAllString(input, strings.ToUpper(acronym)) + } return strings.Title(strings.ReplaceAll(input, "-", " ")) }