Skip to content

Commit

Permalink
Remove duplicate copy of truncateLongMessage function from rules/prov…
Browse files Browse the repository at this point in the history
…ider.go
  • Loading branch information
aka-msft committed Aug 26, 2020
1 parent db1ebfc commit 92becc8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
2 changes: 1 addition & 1 deletion rules/azurerm_storage_account_invalid_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (r *AzurermStorageAccountInvalidNameRule) Check(runner tflint.Runner) error
if !r.pattern.MatchString(val) {
runner.EmitIssueOnExpr(
r,
fmt.Sprintf(`"%s" does not match valid pattern %s`, truncateLongMessage(val), `^[a-z0-9]{3,24}$`),
fmt.Sprintf(`"%s" does not match valid pattern %s`, val, `^[a-z0-9]{3,24}$`),
attribute.Expr,
)
}
Expand Down
16 changes: 0 additions & 16 deletions rules/provider.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package rules

import (
"strings"

"github.com/terraform-linters/tflint-plugin-sdk/tflint"
"github.com/terraform-linters/tflint-ruleset-azurerm/rules/apispec"
)
Expand All @@ -16,17 +14,3 @@ var Rules = append([]tflint.Rule{
NewAzurermWindowsVirtualMachineInvalidSizeRule(),
NewAzurermWindowsVirtualMachineScaleSetInvalidSkuRule(),
}, apispec.Rules...)

func truncateLongMessage(str string) string {
limit := 80

str = strings.Replace(str, "\r\n", "\n", -1)
str = strings.Replace(str, "\n", "\\n", -1)

r := []rune(str)
if len(r) > limit {
return string(r[0:limit]) + "..."
}

return str
}

0 comments on commit 92becc8

Please sign in to comment.