Skip to content

Commit 5327171

Browse files
committed
Regenerate rules with fixed pattern transforms
Pattern transforms are now working correctly: - Cognito SMS message patterns properly transformed from ^\{####\}$ to ^.*\{####\}.*$ - All pattern compatibility transforms applied correctly - All tests passing
1 parent c6be3a4 commit 5327171

5 files changed

+7
-7
lines changed

rules/models/aws_cognito_user_pool_invalid_sms_authentication_message.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func NewAwsCognitoUserPoolInvalidSmsAuthenticationMessageRule() *AwsCognitoUserP
2929
attributeName: "sms_authentication_message",
3030
max: 140,
3131
min: 6,
32-
pattern: regexp.MustCompile(`^\{####\}$`),
32+
pattern: regexp.MustCompile(`^.*\{####\}.*$`),
3333
}
3434
}
3535

@@ -90,7 +90,7 @@ func (r *AwsCognitoUserPoolInvalidSmsAuthenticationMessageRule) Check(runner tfl
9090
if !r.pattern.MatchString(val) {
9191
runner.EmitIssue(
9292
r,
93-
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^\{####\}$`),
93+
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^.*\{####\}.*$`),
9494
attribute.Expr.Range(),
9595
)
9696
}

rules/models/aws_cognito_user_pool_invalid_sms_authentication_message_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ resource "aws_cognito_user_pool" "foo" {
2424
Expected: helper.Issues{
2525
{
2626
Rule: NewAwsCognitoUserPoolInvalidSmsAuthenticationMessageRule(),
27-
Message: fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage("Authentication code"), `^\{####\}$`),
27+
Message: fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage("Authentication code"), `^.*\{####\}.*$`),
2828
},
2929
},
3030
},

rules/models/aws_cognito_user_pool_invalid_sms_verification_message.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func NewAwsCognitoUserPoolInvalidSmsVerificationMessageRule() *AwsCognitoUserPoo
2929
attributeName: "sms_verification_message",
3030
max: 140,
3131
min: 6,
32-
pattern: regexp.MustCompile(`^\{####\}$`),
32+
pattern: regexp.MustCompile(`^.*\{####\}.*$`),
3333
}
3434
}
3535

@@ -90,7 +90,7 @@ func (r *AwsCognitoUserPoolInvalidSmsVerificationMessageRule) Check(runner tflin
9090
if !r.pattern.MatchString(val) {
9191
runner.EmitIssue(
9292
r,
93-
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^\{####\}$`),
93+
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^.*\{####\}.*$`),
9494
attribute.Expr.Range(),
9595
)
9696
}

rules/models/aws_cognito_user_pool_invalid_sms_verification_message_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ resource "aws_cognito_user_pool" "foo" {
2424
Expected: helper.Issues{
2525
{
2626
Rule: NewAwsCognitoUserPoolInvalidSmsVerificationMessageRule(),
27-
Message: fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage("Verification code"), `^\{####\}$`),
27+
Message: fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage("Verification code"), `^.*\{####\}.*$`),
2828
},
2929
},
3030
},

rules/models/generator/rule.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func replacePattern(pattern string) string {
134134
if replaced == "\\S" {
135135
return "^.*\\S.*$"
136136
}
137-
return fmt.Sprintf("^%s$", replaced)
137+
replaced = fmt.Sprintf("^%s$", replaced)
138138
}
139139

140140
// Apply compatibility transforms to maintain backward compatibility with Ruby SDK

0 commit comments

Comments
 (0)