-
Notifications
You must be signed in to change notification settings - Fork 3
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
refactor: new validation rule interface #399
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #399 +/- ##
==========================================
- Coverage 54.02% 53.78% -0.24%
==========================================
Files 21 22 +1
Lines 1131 1136 +5
==========================================
Hits 611 611
- Misses 452 457 +5
Partials 68 68
Continue to review full report in Codecov by Sentry.
|
Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
Made some changes after review.
|
dosubot
bot
added
the
size:M
This PR changes 30-99 lines, ignoring generated files.
label
Aug 22, 2024
Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
TylerGillson
approved these changes
Aug 22, 2024
mattwelke
pushed a commit
that referenced
this pull request
Aug 22, 2024
🤖 I have created a release *beep* *boop* --- ## [0.1.7](v0.1.6...v0.1.7) (2024-08-22) ### Refactoring * new validation rule interface ([#399](#399)) ([6b16845](6b16845)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
New interface to help with working with rule names in a consistent way across the ecosystem.
Plugins would be required to implement it for easy integration with programs like
validatorctl
. They can do that by embeddingvalidationrule.ManuallyNamed
orvalidationrule.AutomaticallyNamed
into their rule struct and implementing the required methods. If they embedvalidationrule.AutomaticallyNamed
, they don't need to implementSetName
. Example:They should also assert that their rule implements the interface. Example:
For rules that are manually named, it is expected that only pointers to rules can implement the interface because of the pointer receiver of implementations of
SetName
. Example: