Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Add pre-commit #12

wants to merge 5 commits into from

Conversation

acontry
Copy link
Contributor

@acontry acontry commented Oct 28, 2022

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 every git 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.

@@ -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 {
Copy link
Contributor Author

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 {
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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)
Copy link
Contributor Author

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

Comment on lines +46 to +47
// TODO: Update to `NewKeyedTransactorWithChainID`
opts := bind.NewKeyedTransactor(a.PrivateKey) //nolint:all
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant