-
Notifications
You must be signed in to change notification settings - Fork 61
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
chore: use the nested if's linter to reduce complexity globally #1158
Changes from 7 commits
f086a2b
421d82d
807f47d
3e91bb5
47bb099
48c466f
088e385
cce08f2
3a1890a
1731968
938a9ab
68291dc
280d3c4
b59babd
54974cb
2e16c9e
48d8543
b4540b5
24f448e
0d21044
e7dd00d
d873bc6
690bd5c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,22 +38,19 @@ var _ wasmkeeper.Messenger = (*CustomMessenger)(nil) | |
// DispatchMsg executes on the contractMsg. | ||
func (m *CustomMessenger) DispatchMsg(ctx sdk.Context, contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg) ([]sdk.Event, [][]byte, error) { | ||
if msg.Custom != nil { | ||
// only handle the happy path where this is really creating / minting / swapping ... | ||
// leave everything else for the wrapped version | ||
var contractMsg bindings.TokenFactoryMsg | ||
if err := json.Unmarshal(msg.Custom, &contractMsg); err != nil { | ||
return nil, nil, sdkioerrors.Wrap(err, "TokenFactoryMsg msg") | ||
} | ||
if contractMsg.CreateDenom != nil { | ||
|
||
switch { | ||
case contractMsg.CreateDenom != nil: | ||
return m.createDenom(ctx, contractAddr, contractMsg.CreateDenom) | ||
} | ||
if contractMsg.MintTokens != nil { | ||
case contractMsg.MintTokens != nil: | ||
return m.mintTokens(ctx, contractAddr, contractMsg.MintTokens) | ||
} | ||
if contractMsg.ChangeAdmin != nil { | ||
case contractMsg.ChangeAdmin != nil: | ||
return m.changeAdmin(ctx, contractAddr, contractMsg.ChangeAdmin) | ||
} | ||
if contractMsg.BurnTokens != nil { | ||
case contractMsg.BurnTokens != nil: | ||
Comment on lines
+45
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The refactoring to use a |
||
return m.burnTokens(ctx, contractAddr, contractMsg.BurnTokens) | ||
} | ||
} | ||
|
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.
The explicit disabling of the
unhandled-error
rule with specific arguments indicates a targeted approach to ignore unhandled errors from certain functions. While this can be useful for reducing noise from known benign unhandled errors, it's important to ensure that this does not inadvertently mask genuine issues. Consider reviewing these exceptions periodically to ensure they remain valid.Consider adding a comment explaining the rationale behind each ignored function to ensure future maintainability and understanding of these exceptions.