Skip to content

Commit

Permalink
MQE: lint that list of functions is sorted (#10775)
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskorn authored Mar 3, 2025
1 parent 0394438 commit e2aa729
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/streamingpromql/functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ func SortOperatorFactory(descending bool) InstantVectorFunctionOperatorFactory {

// These functions return an instant-vector.
var instantVectorFunctionOperatorFactories = map[string]InstantVectorFunctionOperatorFactory{
// Please keep this list sorted alphabetically.
//lint:sorted
"abs": InstantVectorTransformationFunctionOperatorFactory("abs", functions.Abs),
"absent": AbsentFunctionOperatorFactory,
"acos": InstantVectorTransformationFunctionOperatorFactory("acos", functions.Acos),
Expand All @@ -569,10 +569,10 @@ var instantVectorFunctionOperatorFactories = map[string]InstantVectorFunctionOpe
"cos": InstantVectorTransformationFunctionOperatorFactory("cos", functions.Cos),
"cosh": InstantVectorTransformationFunctionOperatorFactory("cosh", functions.Cosh),
"count_over_time": FunctionOverRangeVectorOperatorFactory("count_over_time", functions.CountOverTime),
"days_in_month": TimeTransformationFunctionOperatorFactory("days_in_month", functions.DaysInMonth),
"day_of_month": TimeTransformationFunctionOperatorFactory("day_of_month", functions.DayOfMonth),
"day_of_week": TimeTransformationFunctionOperatorFactory("day_of_week", functions.DayOfWeek),
"day_of_year": TimeTransformationFunctionOperatorFactory("day_of_year", functions.DayOfYear),
"days_in_month": TimeTransformationFunctionOperatorFactory("days_in_month", functions.DaysInMonth),
"deg": InstantVectorTransformationFunctionOperatorFactory("deg", functions.Deg),
"delta": FunctionOverRangeVectorOperatorFactory("delta", functions.Delta),
"deriv": FunctionOverRangeVectorOperatorFactory("deriv", functions.Deriv),
Expand Down
4 changes: 2 additions & 2 deletions pkg/streamingpromql/functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func TestFunctionDeduplicateAndMerge(t *testing.T) {
step := time.Minute

expressions := map[string]string{
// Please keep this list sorted alphabetically.
//lint:sorted
"abs": `abs({__name__=~"float.*"})`,
"absent": `<skip>`,
"acos": `acos({__name__=~"float.*"})`,
Expand All @@ -96,10 +96,10 @@ func TestFunctionDeduplicateAndMerge(t *testing.T) {
"cos": `cos({__name__=~"float.*"})`,
"cosh": `cosh({__name__=~"float.*"})`,
"count_over_time": `count_over_time({__name__=~"float.*"}[1m])`,
"days_in_month": `days_in_month({__name__=~"float.*"})`,
"day_of_month": `day_of_month({__name__=~"float.*"})`,
"day_of_week": `day_of_week({__name__=~"float.*"})`,
"day_of_year": `day_of_year({__name__=~"float.*"})`,
"days_in_month": `days_in_month({__name__=~"float.*"})`,
"deg": `deg({__name__=~"float.*"})`,
"delta": `delta({__name__=~"float.*"}[1m])`,
"deriv": `deriv({__name__=~"float.*"}[1m])`,
Expand Down

0 comments on commit e2aa729

Please sign in to comment.