From 2e97baabf63aac719852e0e77fbf57d7df87d12c Mon Sep 17 00:00:00 2001 From: Dev Ojha Date: Mon, 25 Jun 2018 11:23:17 -0700 Subject: [PATCH] Merge PR #1358: Fix typos and gofmt files * Fix typos * gofmt -s files * Add mispellings and gofmt checks to circle CI * circleci: Install misspell in the linting step --- .circleci/config.yml | 5 +++-- CHANGELOG.md | 1 + baseapp/baseapp.go | 2 +- client/lcd/lcd_test.go | 14 +++++++------- examples/democoin/x/cool/app_test.go | 2 +- store/iavlstore_test.go | 24 ++++++++++++------------ types/errors.go | 2 +- types/gas.go | 2 -- x/auth/stdtx.go | 2 +- x/bank/msgs_test.go | 4 ++-- x/gov/keeper.go | 2 +- 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 13c6f330e..ce01e3971 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -62,12 +62,13 @@ jobs: command: | export PATH="$GOBIN:$PATH" make get_tools + go get -u github.com/client9/misspell/cmd/misspell - run: name: Lint source command: | export PATH="$GOBIN:$PATH" - gometalinter.v2 --disable-all --enable='golint' --vendor ./... - + gometalinter.v2 --disable-all --enable='golint' --enable='misspell' --vendor ./... + find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s test_unit: <<: *defaults parallelism: 1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bc975ce5..8f1ef031e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ FEATURES * Delegators delegate votes to validator by default but can override (for their stake) * [tools] make get_tools installs tendermint's linter, and gometalinter * [tools] Switch gometalinter to the stable version +* [tools] Add checking for misspellings and for incorrectly formatted files in circle CI * [server] Default config now creates a profiler at port 6060, and increase p2p send/recv rates FIXES diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index ee1ec4ca9..3150e84a5 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -179,7 +179,7 @@ func (app *BaseApp) LastCommitID() sdk.CommitID { return app.cms.LastCommitID() } -// the last commited block height +// the last committed block height func (app *BaseApp) LastBlockHeight() int64 { return app.cms.LastCommitID().Version } diff --git a/client/lcd/lcd_test.go b/client/lcd/lcd_test.go index 1c8f872fc..b56c27b95 100644 --- a/client/lcd/lcd_test.go +++ b/client/lcd/lcd_test.go @@ -236,7 +236,7 @@ func TestCoinSend(t *testing.T) { receiveAddr, resultTx := doSend(t, port, seed, name, password, addr) tests.WaitForHeight(resultTx.Height+1, port) - // check if tx was commited + // check if tx was committed assert.Equal(t, uint32(0), resultTx.CheckTx.Code) assert.Equal(t, uint32(0), resultTx.DeliverTx.Code) @@ -271,7 +271,7 @@ func TestIBCTransfer(t *testing.T) { tests.WaitForHeight(resultTx.Height+1, port) - // check if tx was commited + // check if tx was committed assert.Equal(t, uint32(0), resultTx.CheckTx.Code) assert.Equal(t, uint32(0), resultTx.DeliverTx.Code) @@ -387,7 +387,7 @@ func TestBonding(t *testing.T) { resultTx := doBond(t, port, seed, name, password, addr, validator1Owner) tests.WaitForHeight(resultTx.Height+1, port) - // check if tx was commited + // check if tx was committed assert.Equal(t, uint32(0), resultTx.CheckTx.Code) assert.Equal(t, uint32(0), resultTx.DeliverTx.Code) @@ -412,7 +412,7 @@ func TestBonding(t *testing.T) { bond = getDelegation(t, port, addr, validator1Owner) assert.Equal(t, "30/1", bond.Shares.String()) - // check if tx was commited + // check if tx was committed assert.Equal(t, uint32(0), resultTx.CheckTx.Code) assert.Equal(t, uint32(0), resultTx.DeliverTx.Code) @@ -434,7 +434,7 @@ func TestSubmitProposal(t *testing.T) { resultTx := doSubmitProposal(t, port, seed, name, password, addr) tests.WaitForHeight(resultTx.Height+1, port) - // check if tx was commited + // check if tx was committed assert.Equal(t, uint32(0), resultTx.CheckTx.Code) assert.Equal(t, uint32(0), resultTx.DeliverTx.Code) @@ -456,7 +456,7 @@ func TestDeposit(t *testing.T) { resultTx := doSubmitProposal(t, port, seed, name, password, addr) tests.WaitForHeight(resultTx.Height+1, port) - // check if tx was commited + // check if tx was committed assert.Equal(t, uint32(0), resultTx.CheckTx.Code) assert.Equal(t, uint32(0), resultTx.DeliverTx.Code) @@ -486,7 +486,7 @@ func TestVote(t *testing.T) { resultTx := doSubmitProposal(t, port, seed, name, password, addr) tests.WaitForHeight(resultTx.Height+1, port) - // check if tx was commited + // check if tx was committed assert.Equal(t, uint32(0), resultTx.CheckTx.Code) assert.Equal(t, uint32(0), resultTx.DeliverTx.Code) diff --git a/examples/democoin/x/cool/app_test.go b/examples/democoin/x/cool/app_test.go index 487111bb3..5ac7a55a1 100644 --- a/examples/democoin/x/cool/app_test.go +++ b/examples/democoin/x/cool/app_test.go @@ -100,7 +100,7 @@ func TestMsgQuiz(t *testing.T) { mock.SignCheckDeliver(t, mapp.BaseApp, []sdk.Msg{setTrendMsg2}, []int64{0}, []int64{4}, true, priv1) // reset the trend mock.SignCheckDeliver(t, mapp.BaseApp, []sdk.Msg{quizMsg1}, []int64{0}, []int64{5}, false, priv1) // the same answer will nolonger do! mock.CheckBalance(t, mapp, addr1, sdk.Coins{{"icecold", sdk.NewInt(138)}}) - mock.SignCheckDeliver(t, mapp.BaseApp, []sdk.Msg{quizMsg2}, []int64{0}, []int64{6}, true, priv1) // earlier answer now relavent again + mock.SignCheckDeliver(t, mapp.BaseApp, []sdk.Msg{quizMsg2}, []int64{0}, []int64{6}, true, priv1) // earlier answer now relevant again mock.CheckBalance(t, mapp, addr1, sdk.Coins{{"badvibesonly", sdk.NewInt(69)}, {"icecold", sdk.NewInt(138)}}) mock.SignCheckDeliver(t, mapp.BaseApp, []sdk.Msg{setTrendMsg3}, []int64{0}, []int64{7}, false, priv1) // expect to fail to set the trend to something which is not cool } diff --git a/store/iavlstore_test.go b/store/iavlstore_test.go index e324758c5..e2f2f9c17 100644 --- a/store/iavlstore_test.go +++ b/store/iavlstore_test.go @@ -170,9 +170,9 @@ func TestIAVLSubspaceIterator(t *testing.T) { iter = sdk.KVStorePrefixIterator(iavlStore, []byte{byte(55), byte(255), byte(255)}) expected2 := [][]byte{ - []byte{byte(55), byte(255), byte(255), byte(0)}, - []byte{byte(55), byte(255), byte(255), byte(1)}, - []byte{byte(55), byte(255), byte(255), byte(255)}, + {byte(55), byte(255), byte(255), byte(0)}, + {byte(55), byte(255), byte(255), byte(1)}, + {byte(55), byte(255), byte(255), byte(255)}, } for i = 0; iter.Valid(); iter.Next() { expectedKey := expected2[i] @@ -185,9 +185,9 @@ func TestIAVLSubspaceIterator(t *testing.T) { iter = sdk.KVStorePrefixIterator(iavlStore, []byte{byte(255), byte(255)}) expected2 = [][]byte{ - []byte{byte(255), byte(255), byte(0)}, - []byte{byte(255), byte(255), byte(1)}, - []byte{byte(255), byte(255), byte(255)}, + {byte(255), byte(255), byte(0)}, + {byte(255), byte(255), byte(1)}, + {byte(255), byte(255), byte(255)}, } for i = 0; iter.Valid(); iter.Next() { expectedKey := expected2[i] @@ -229,9 +229,9 @@ func TestIAVLReverseSubspaceIterator(t *testing.T) { iter = sdk.KVStoreReversePrefixIterator(iavlStore, []byte{byte(55), byte(255), byte(255)}) expected2 := [][]byte{ - []byte{byte(55), byte(255), byte(255), byte(255)}, - []byte{byte(55), byte(255), byte(255), byte(1)}, - []byte{byte(55), byte(255), byte(255), byte(0)}, + {byte(55), byte(255), byte(255), byte(255)}, + {byte(55), byte(255), byte(255), byte(1)}, + {byte(55), byte(255), byte(255), byte(0)}, } for i = 0; iter.Valid(); iter.Next() { expectedKey := expected2[i] @@ -244,9 +244,9 @@ func TestIAVLReverseSubspaceIterator(t *testing.T) { iter = sdk.KVStoreReversePrefixIterator(iavlStore, []byte{byte(255), byte(255)}) expected2 = [][]byte{ - []byte{byte(255), byte(255), byte(255)}, - []byte{byte(255), byte(255), byte(1)}, - []byte{byte(255), byte(255), byte(0)}, + {byte(255), byte(255), byte(255)}, + {byte(255), byte(255), byte(1)}, + {byte(255), byte(255), byte(0)}, } for i = 0; iter.Valid(); iter.Next() { expectedKey := expected2[i] diff --git a/types/errors.go b/types/errors.go index f76b171af..c81808427 100644 --- a/types/errors.go +++ b/types/errors.go @@ -77,7 +77,7 @@ func CodeToDefaultMsg(code CodeType) string { case CodeUnauthorized: return "unauthorized" case CodeInsufficientFunds: - return "insufficent funds" + return "insufficient funds" case CodeUnknownRequest: return "unknown request" case CodeInvalidAddress: diff --git a/types/gas.go b/types/gas.go index 49bfa27ec..18d3aa570 100644 --- a/types/gas.go +++ b/types/gas.go @@ -1,7 +1,5 @@ package types -import () - // Gas measured by the SDK type Gas = int64 diff --git a/x/auth/stdtx.go b/x/auth/stdtx.go index 8f3e52764..07b8671b7 100644 --- a/x/auth/stdtx.go +++ b/x/auth/stdtx.go @@ -34,7 +34,7 @@ func (tx StdTx) GetMsgs() []sdk.Msg { return tx.Msgs } // Addresses are returned in a determistic order. // They are accumulated from the GetSigners method for each Msg // in the order they appear in tx.GetMsgs(). -// Duplicate addresses will be ommitted. +// Duplicate addresses will be omitted. func (tx StdTx) GetSigners() []sdk.Address { seen := map[string]bool{} var signers []sdk.Address diff --git a/x/bank/msgs_test.go b/x/bank/msgs_test.go index b866e497b..e5cb75907 100644 --- a/x/bank/msgs_test.go +++ b/x/bank/msgs_test.go @@ -132,13 +132,13 @@ func TestMsgSendValidation(t *testing.T) { }{ {false, MsgSend{}}, // no input or output {false, MsgSend{Inputs: []Input{input1}}}, // just input - {false, MsgSend{Outputs: []Output{output1}}}, // just ouput + {false, MsgSend{Outputs: []Output{output1}}}, // just output {false, MsgSend{ Inputs: []Input{NewInput(emptyAddr, atom123)}, // invalid input Outputs: []Output{output1}}}, {false, MsgSend{ Inputs: []Input{input1}, - Outputs: []Output{{emptyAddr, atom123}}}, // invalid ouput + Outputs: []Output{{emptyAddr, atom123}}}, // invalid output }, {false, MsgSend{ Inputs: []Input{input1}, diff --git a/x/gov/keeper.go b/x/gov/keeper.go index d0ce12982..bc9153304 100644 --- a/x/gov/keeper.go +++ b/x/gov/keeper.go @@ -243,7 +243,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID int64, depositerAddr return ErrAlreadyFinishedProposal(keeper.codespace, proposalID), false } - // Subtract coins from depositers account + // Subtract coins from depositer's account _, _, err := keeper.ck.SubtractCoins(ctx, depositerAddr, depositAmount) if err != nil { return err, false