You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking at the code in silence.go and – unless I'm being obtuse – I think some of the comments and tests are documented as working the opposite way from how they actually work.
For example, the comment for silenceFilter is:
// silenceFilter is a function that returns true if a silence// should be dropped from a result set for a given time.typesilenceFilterfunc(*pb.Silence, *Silences, time.Time) (bool, error)
The important phrase:
returns true if a silence should be dropped from a result set
And the tests for some of the filters support this:
it seems that if the filter returns true, then it is instead included in the result set, and removed if it returns false. This is the opposite of what is in the comment:
returns true if a silence should be dropped from a result set
because if "returns true if a silence should be dropped from a result set" were true, then the IDs 1 and 2 would be excluded from the result, rather than expected.
I just wanted to check that I'm not confused before I open a PR to fix this.
The text was updated successfully, but these errors were encountered:
What did you do?
I was looking at the code in
silence.go
and – unless I'm being obtuse – I think some of the comments and tests are documented as working the opposite way from how they actually work.For example, the comment for
silenceFilter
is:The important phrase:
And the tests for some of the filters support this:
However, if I look in
query
where these functions are used:it seems that if the filter returns true, then it is instead included in the result set, and removed if it returns false. This is the opposite of what is in the comment:
The tests for querying seem to support this too:
because if "returns true if a silence should be dropped from a result set" were true, then the IDs 1 and 2 would be excluded from the result, rather than expected.
I just wanted to check that I'm not confused before I open a PR to fix this.
The text was updated successfully, but these errors were encountered: