Skip to content

Commit

Permalink
pr suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
rambleraptor committed Dec 10, 2024
1 parent 5c50594 commit 9c0085a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion rules/aep0004/resource_plural.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var resourcePlural = &lint.MessageRule{
r := utils.GetResource(m)
l := locations.MessageResource(m)
p := r.GetPlural()
pLower := utils.ToKebobCase(p)
pLower := utils.ToKebabCase(p)
if p == "" {
return []lint.Problem{{
Message: "Resources should declare plural.",
Expand Down
2 changes: 1 addition & 1 deletion rules/aep0004/resource_singular.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var resourceSingular = &lint.MessageRule{
l := locations.MessageResource(m)
s := r.GetSingular()
_, typeName, ok := utils.SplitResourceTypeName(r.GetType())
lowerTypeName := utils.ToKebobCase(typeName)
lowerTypeName := utils.ToKebabCase(typeName)
if s == "" {
return []lint.Problem{{
Message: fmt.Sprintf("Resources should declare singular: %q", lowerTypeName),
Expand Down
6 changes: 3 additions & 3 deletions rules/aep0004/resource_type_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ var resourceTypeName = &lint.MessageRule{
LintMessage: func(m *desc.MessageDescriptor) []lint.Problem {
resource := utils.GetResource(m)
_, typeName, ok := utils.SplitResourceTypeName(resource.GetType())
kebob_case := utils.ToKebobCase(typeName)
kebabCase := utils.ToKebabCase(typeName)
if !ok {
return []lint.Problem{{
Message: "Resource type names must be of the form {Service Name}/{Type}.",
Descriptor: m,
Location: locations.MessageResource(m),
}}
}
if kebob_case != typeName {
if kebabCase != typeName {
return []lint.Problem{{
Message: fmt.Sprintf("Type must be kebob-case with alphanumeric characters: %q", kebob_case),
Message: fmt.Sprintf("Type must be kebob-case with alphanumeric characters: %q", kebabCase),
Descriptor: m,
Location: locations.MessageResource(m),
}}
Expand Down
4 changes: 2 additions & 2 deletions rules/internal/utils/casing.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

package utils

// ToKebobCase returns the kebob-case of a word (book-edition).
func ToKebobCase(s string) string {
// ToKebabCase returns the kebob-case of a word (book-edition).
func ToKebabCase(s string) string {
asLower := make([]rune, 0, len(s))
for i, r := range s {
if isUpper(r) {
Expand Down
4 changes: 2 additions & 2 deletions rules/internal/utils/casing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ func TestToUpperCamelCase(t *testing.T) {
},
} {
t.Run(test.name, func(t *testing.T) {
got := ToKebobCase(test.input)
got := ToKebabCase(test.input)
if got != test.want {
t.Errorf("ToKebobCase(%q) = %q, got %q", test.input, test.want, got)
t.Errorf("ToKebabCase(%q) = %q, got %q", test.input, test.want, got)
}
})
}
Expand Down

0 comments on commit 9c0085a

Please sign in to comment.