-
Notifications
You must be signed in to change notification settings - Fork 399
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
Add findandmodify
to the common.Commands
map
#1730
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1730 +/- ##
==========================================
- Coverage 69.07% 69.01% -0.07%
==========================================
Files 301 301
Lines 14297 14303 +6
==========================================
- Hits 9876 9871 -5
- Misses 3493 3496 +3
- Partials 928 936 +8
Flags with carried forward coverage won't be shown. Click here to find out more. |
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.
LGTM!
@noisersup I pushed another commit to clean up a bit. PTAL. |
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.
Let's also update TestCommandsDiagnosticListCommands
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.
So, in this solution, we use a separate ignoreLowercaseCmds
map to store "ignored" values. I like it because it stores the exact things we don't want to show (lower-cased commands). On the other hand, if we have more duplicates, we must remember to add them to ignoreLowercaseCmds
too.
Another potential way would be to iterate through Commands
, store unique commands in a map and check for duplicates (for example, like we did here - https://github.com/FerretDB/FerretDB/blob/main/internal/types/document_validation.go#L71).
But I like your solution more because with your solution we don't need to take care of letters lower/upper case etc.
@b1ron linter complains a little bit because empty structs in your map can be set simpler (just |
Yes will fix that. Thanks! |
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.
LGTM
findandmodify
to MsgListCommands
findandmodify
to the common.Commands
map
Description
Closes #1727.
Readiness checklist
task all
, and it passed.task godocs
.@FerretDB/core
), Assignee, Labels, Project and project's Sprint fields.