Skip to content

Commit

Permalink
fix: AIP-140 – Permit hour_of_day and day_of_week. (#570)
Browse files Browse the repository at this point in the history
It makes no sense to flag on this because we called the message
`google.type.DayOfWeek`.
  • Loading branch information
Luke Sneeringer authored Jun 19, 2020
1 parent 3cf71fe commit 38113d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rules/aip0140/prepositions.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
var noPrepositions = &lint.FieldRule{
Name: lint.NewRuleName(140, "prepositions"),
OnlyIf: func(f *desc.FieldDescriptor) bool {
return !stringset.New("order_by", "group_by").Contains(f.GetName())
return !stringset.New("order_by", "group_by", "hour_of_day", "day_of_week").Contains(f.GetName())
},
LintField: func(f *desc.FieldDescriptor) (problems []lint.Problem) {
for _, word := range strings.Split(f.GetName(), "_") {
Expand Down
2 changes: 2 additions & 0 deletions rules/aip0140/prepositions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func TestNoPrepositions(t *testing.T) {
{"move_toward_shelf_at_front", testutils.Problems{{Message: "toward"}, {Message: "at"}}},
{"order_by", testutils.Problems{}},
{"group_by", testutils.Problems{}},
{"hour_of_day", testutils.Problems{}},
{"day_of_week", testutils.Problems{}},
}
for _, test := range tests {
t.Run(test.Name, func(t *testing.T) {
Expand Down

0 comments on commit 38113d3

Please sign in to comment.