-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DRY up ignore related conditionals #103
Conversation
internal/evaluator/builder.go
Outdated
// only need the zero value for checking ignore_empty constraint | ||
val.IgnoreEmpty = forItems && bldr.shouldIgnoreEmpty(constraints) | ||
if val.IgnoreEmpty { | ||
val.Zero = bldr.zeroValue(fdesc, forItems) | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove this return and fall back to one immediately after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird that a linter didn't catch that...
fieldConstraints.GetIgnore() == validate.Ignore_IGNORE_IF_UNPOPULATED || | ||
fieldConstraints.GetIgnore() == validate.Ignore_IGNORE_IF_DEFAULT_VALUE, | ||
IgnoreDefault: fieldDescriptor.HasPresence() && fieldConstraints.GetIgnore() == validate.Ignore_IGNORE_IF_DEFAULT_VALUE, | ||
bldr.shouldIgnoreEmpty(fieldConstraints), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Could put these back on one line if you want now that they're much shorter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kinda like it on multiple lines personally 😅
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/bufbuild/protovalidate-go](https://github.com/bufbuild/protovalidate-go) | `v0.6.0` -> `v0.6.1` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fbufbuild%2fprotovalidate-go/v0.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fbufbuild%2fprotovalidate-go/v0.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fbufbuild%2fprotovalidate-go/v0.6.0/v0.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fbufbuild%2fprotovalidate-go/v0.6.0/v0.6.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | | [google.golang.org/grpc](https://github.com/grpc/grpc-go) | `v1.62.1` -> `v1.63.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/google.golang.org%2fgrpc/v1.63.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/google.golang.org%2fgrpc/v1.63.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/google.golang.org%2fgrpc/v1.62.1/v1.63.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/google.golang.org%2fgrpc/v1.62.1/v1.63.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>bufbuild/protovalidate-go (github.com/bufbuild/protovalidate-go)</summary> ### [`v0.6.1`](https://github.com/bufbuild/protovalidate-go/releases/tag/v0.6.1) [Compare Source](https://github.com/bufbuild/protovalidate-go/compare/v0.6.0...v0.6.1) #### What's Changed - Update license years and fix makefile by [@​pkwarren](https://github.com/pkwarren) in [https://github.com/bufbuild/protovalidate-go/pull/102](https://github.com/bufbuild/protovalidate-go/pull/102) - DRY up ignore related conditionals by [@​rodaine](https://github.com/rodaine) in [https://github.com/bufbuild/protovalidate-go/pull/103](https://github.com/bufbuild/protovalidate-go/pull/103) - Bump the go group with 1 update by [@​dependabot](https://github.com/dependabot) in [https://github.com/bufbuild/protovalidate-go/pull/106](https://github.com/bufbuild/protovalidate-go/pull/106) - Bump the go group with 3 updates by [@​dependabot](https://github.com/dependabot) in [https://github.com/bufbuild/protovalidate-go/pull/109](https://github.com/bufbuild/protovalidate-go/pull/109) - Bump Go min version to 1.20 by [@​jhump](https://github.com/jhump) in [https://github.com/bufbuild/protovalidate-go/pull/110](https://github.com/bufbuild/protovalidate-go/pull/110) - Update README.md by [@​rodaine](https://github.com/rodaine) in [https://github.com/bufbuild/protovalidate-go/pull/111](https://github.com/bufbuild/protovalidate-go/pull/111) - Add tuuid conformance tests by [@​rodaine](https://github.com/rodaine) in [https://github.com/bufbuild/protovalidate-go/pull/114](https://github.com/bufbuild/protovalidate-go/pull/114) - Add generate check CI step by [@​rodaine](https://github.com/rodaine) in [https://github.com/bufbuild/protovalidate-go/pull/115](https://github.com/bufbuild/protovalidate-go/pull/115) #### New Contributors - [@​jhump](https://github.com/jhump) made their first contribution in [https://github.com/bufbuild/protovalidate-go/pull/110](https://github.com/bufbuild/protovalidate-go/pull/110) **Full Changelog**: bufbuild/protovalidate-go@v0.6.0...v0.6.1 </details> <details> <summary>grpc/grpc-go (google.golang.org/grpc)</summary> ### [`v1.63.0`](https://github.com/grpc/grpc-go/releases/tag/v1.63.0): Release 1.63.0 [Compare Source](https://github.com/grpc/grpc-go/compare/v1.62.2...v1.63.0) ### Behavior Changes - grpc: Return canonical target string from `resolver.Address.String()` (experimental) ([#​6923](https://github.com/grpc/grpc-go/issues/6923)) - client & server: when using write buffer pooling, use input value for buffer size instead of size\*2 ([#​6983](https://github.com/grpc/grpc-go/issues/6983)) - Special Thanks: [@​raghav-stripe](https://github.com/raghav-stripe) ### New Features - grpc: add `ClientConn.CanonicalTarget()` to return the canonical target string. ([#​7006](https://github.com/grpc/grpc-go/issues/7006)) - xds: implement LRS named metrics support ([gRFC A64](https://github.com/grpc/proposal/blob/master/A64-lrs-custom-metrics.md)) ([#​7027](https://github.com/grpc/grpc-go/issues/7027)) - Special Thanks: [@​danielzhaotongliu](https://github.com/danielzhaotongliu) - grpc: introduce `grpc.NewClient` to allow users to create new clients in idle mode and with "dns" as the default resolver ([#​7010](https://github.com/grpc/grpc-go/issues/7010)) - Special Thanks: [@​bruuuuuuuce](https://github.com/bruuuuuuuce) ### API Changes - grpc: stabilize experimental method `ClientConn.Target()` ([#​7006](https://github.com/grpc/grpc-go/issues/7006)) ### Bug Fixes - xds: fix an issue that would cause the client to send an empty list of resources for LDS/CDS upon reconnecting with the management server ([#​7026](https://github.com/grpc/grpc-go/issues/7026)) - server: Fix some errors returned by a server when using a `grpc.Server` as an `http.Handler` with the Go stdlib HTTP server ([#​6989](https://github.com/grpc/grpc-go/issues/6989)) - resolver/dns: add `SetResolvingTimeout` to allow configuring the DNS resolver's global timeout ([#​6917](https://github.com/grpc/grpc-go/issues/6917)) - Special Thanks: [@​and1truong](https://github.com/and1truong) - Set the security level of Windows named pipes to NoSecurity ([#​6956](https://github.com/grpc/grpc-go/issues/6956)) - Special Thanks: [@​irsl](https://github.com/irsl) ### [`v1.62.2`](https://github.com/grpc/grpc-go/releases/tag/v1.62.2): Release 1.62.2 [Compare Source](https://github.com/grpc/grpc-go/compare/v1.62.1...v1.62.2) ### Dependencies - Update http2 library to address vulnerability [CVE-2023-45288](https://www.kb.cert.org/vuls/id/421644) </details> --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/cerbos/cerbos-sdk-go). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4yNjkuMiIsInVwZGF0ZWRJblZlciI6IjM3LjI2OS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Charith Ellawala <charith@cerbos.dev> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Charith Ellawala <charith@cerbos.dev>
No description provided.