-
Notifications
You must be signed in to change notification settings - Fork 24
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 pre-commit #12
base: master
Are you sure you want to change the base?
Add pre-commit #12
Conversation
@@ -362,23 +362,23 @@ func GetMinipoolCountPerStatus(rp *rocketpool.RocketPool, opts *bind.CallOpts) ( | |||
if err := rocketMinipoolManager.Call(opts, newMinipoolCounts, "getMinipoolCountPerStatus", offset, limit); err != nil { | |||
return MinipoolCountsPerStatus{}, fmt.Errorf("Could not get minipool counts: %w", err) | |||
} | |||
if newMinipoolCounts != 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.
Linter flagged that this is always true
smoothingPoolRegistrationState bool | ||
smoothingPoolRegistrationChanged *big.Int | ||
} | ||
//type nodeDetails_Native struct { |
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 is unused, but looks like active development so commented it out.
@@ -157,25 +157,6 @@ func (c *Contract) estimateGasLimit(opts *bind.TransactOpts, input []byte) (uint | |||
|
|||
} | |||
|
|||
// Wait for a transaction to be mined and get a tx receipt | |||
func (c *Contract) getTransactionReceipt(tx *types.Transaction) (*types.Receipt, error) { |
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.
Unused method. Since no recent development on this, deleted.
@@ -20,7 +20,7 @@ func GetAddressQueueLength(rp *rocketpool.RocketPool, opts *bind.CallOpts, key [ | |||
} | |||
length := new(*big.Int) | |||
if err := addressQueueStorage.Call(opts, length, "getIndexOf", key); err != nil { | |||
return 0, fmt.Errorf("Could not get address queue length for key: %w", key, err) | |||
return 0, fmt.Errorf("Could not get address queue length for key %x: %w", key, err) |
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.
Chose %x
lower-case hexadecimal repr for [32]bytes
object
// TODO: Update to `NewKeyedTransactorWithChainID` | ||
opts := bind.NewKeyedTransactor(a.PrivateKey) //nolint:all |
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.
Deprecated method. Can pick up in future PR.
Added a simple pre-commit config that uses golangci-lint.
I ran this by installing pre-commit, then
pre-commit run --all-files
and fixed all issues it raised. Most issues are cosmetic, but there did seem to be a couple very minor things that will functionally improve the codebase.I think pre-commit a nice tool to enforce a style standard and catch some classes of errors. I typically run it locally with
pre-commit install
so it runs automatically on everygit commit
, and also in CI (I've used it in github CI in open source).Feel free to cherry-pick from this PR if you don't want to add more tooling just yet. Happy to help integrate this into CI if you're interested though.