Reorg of trigger filtering code#4493
Conversation
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: slinkydeveloper The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold merge after the release |
Codecov Report
@@ Coverage Diff @@
## master #4493 +/- ##
=======================================
Coverage 81.27% 81.27%
=======================================
Files 282 284 +2
Lines 8004 8017 +13
=======================================
+ Hits 6505 6516 +11
- Misses 1112 1113 +1
- Partials 387 388 +1
Continue to review full report at Codecov.
|
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
|
/unhold |
|
/assign |
|
/assign |
Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
|
The following is the coverage report on the affected files.
|
|
/lgtm |
| return attributesFilter(attrs) | ||
| } | ||
|
|
||
| func (attrs attributesFilter) Filter(ctx context.Context, event cloudevents.Event) eventfilter.FilterResult { |
There was a problem hiding this comment.
IMO comment is required for all exported functions. And in this case this function should have comment unless we don't have to export it, which is actually the preferred way.
There was a problem hiding this comment.
So there are 2 reasons why IMO it doesn't make sense to comment here:
- the receiver is unexported, so user cannot address it directly anyway
- we're implementing a contract and there is nothing, in this particular impl, which deviates particularly from the comment in the contract itself. So what the comment should say? The same comment in eventfilter.Filter? Isn't better to just explicitly show in the code the implementation with the type assertions (like i added) so the developer goes to the original contract and checks the updated docs?
Signed-off-by: Francesco Guardiani francescoguard@gmail.com
This PR reorganizes the filtering code to be a little bit more extensible, although it doesn't add, nor modify, any current behaviour of the code. It just makes it simpler to contribute to extend it 😄 I did it to use as a base to enable people experiment new filters (play nice with #3771 and #4279). I have a couple of ideas I'm gonna show in next PRs on filtering, and this serves as a good base. Took from #3771