-
Notifications
You must be signed in to change notification settings - Fork 86
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: flag settings to be shared in option
package
#1187
Conversation
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1187 +/- ##
==========================================
- Coverage 76.08% 75.95% -0.13%
==========================================
Files 71 78 +7
Lines 3625 3594 -31
==========================================
- Hits 2758 2730 -28
+ Misses 670 667 -3
Partials 197 197 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
Signed-off-by: Junjie Gao <[email protected]>
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.
This PR depends on #1192 due to the --allow-referrers-api
flag.
Signed-off-by: Junjie Gao <[email protected]>
Updated. |
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.
After going through this 49-file-change PR, the very first question pop up is do we really need it... I'm not seeing a clear advantage of this refactoring over the original code base though.
The original structure has a clear internal/cmd/flags.go
file containing the flags of Notation. But after the refactor, it's gone. In other words, it reduces the readability of the code base.
If I were new to Notation and would like to contribute on it, adding a flag may already bring in challenge. Originally, I could just simply add it into flags.go, now I have to figure out where to put it.
@Two-Hearts It is true that adding a pattern will slightly increase the learning curve, but for long-term maintenance, learning a pattern is beneficial. I guess you think the original code is more readable because we have worked on the codebase for a while. We are doing the refactoring for future extensibility. In this PR, I grouped the flags into option types. Each option can contain multiple flags to be shared across multiple commands. Each option can have its own methods with processing logic for those flags. For example, When adding a new flag that is only used in a single command, we can directly set the flag in the file that defines the command. If it is a shared flag used in multiple commands, you can create an option under the |
I'm not convinced with the above detailed explanation, if you have to write an essay to explain the change, I'd say it already proves my concern. Let's not make a simple and stable code base more complicated. |
Refactor:
option
packageDocs:
specs/commandline/key.md
Validation:
Resolve part of #1151