From b0d453c00b4d9959d0b593cd48bd6c1760bd772e Mon Sep 17 00:00:00 2001 From: Mateya Lucic Date: Thu, 5 Feb 2026 14:55:30 -0500 Subject: [PATCH] (fix): skip special word handling when word is all uppercase --- internal/ansible/paramconv/paramconv.go | 7 +++++-- internal/ansible/paramconv/paramconv_test.go | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/ansible/paramconv/paramconv.go b/internal/ansible/paramconv/paramconv.go index fd53dbd..6eb4b46 100644 --- a/internal/ansible/paramconv/paramconv.go +++ b/internal/ansible/paramconv/paramconv.go @@ -124,8 +124,11 @@ func ToSnake(s string) string { n := "" iReal := -1 - // append underscore (_) as prefix and postfix to isolate special words defined in the wordMapping - s = preprocessWordMapping(s) + // skip special word handling when entire string is all uppercase (no need to check lowercase since all special words are uppercased) + if strings.ToUpper(s) != s { + // append underscore (_) as prefix and postfix to isolate special words defined in the wordMapping + s = preprocessWordMapping(s) + } for i, v := range s { iReal++ diff --git a/internal/ansible/paramconv/paramconv_test.go b/internal/ansible/paramconv/paramconv_test.go index feac3a0..45c096c 100644 --- a/internal/ansible/paramconv/paramconv_test.go +++ b/internal/ansible/paramconv/paramconv_test.go @@ -231,6 +231,11 @@ func TestToSnake(t *testing.T) { args: args{"URLsegressIPsEgressHTTPs"}, want: "_urls_egress_ips_egress_https", }, + { + name: "should not interpret special word when entire word is uppercase", + args: args{"THIS_IS_SKIP_NOT_SK_IP"}, + want: "_this_is_skip_not_sk_ip", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {