Skip to content

Commit

Permalink
Exclude proto files from format (cosmos#5706)
Browse files Browse the repository at this point in the history
* Don't change proto files on make format

The format target does not need to depend on tools.
Thus remove dependency.

* Run make format

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
  • Loading branch information
Alessio Treglia and alexanderbez committed Feb 27, 2020
1 parent 8227d9e commit 5a2e59e
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 23 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ lint:
go mod verify
.PHONY: lint

format: tools
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/cosmos/cosmos-sdk
format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" -not -name '*.pb.go' | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" -not -name '*.pb.go' | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" -not -name '*.pb.go' | xargs goimports -w -local github.com/cosmos/cosmos-sdk
.PHONY: format

###############################################################################
Expand Down
6 changes: 3 additions & 3 deletions client/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ func TestValidateCmd(t *testing.T) {
args []string
wantErr bool
}{
{"misspelled command", []string{"comission"}, true}, // nolint: misspell
{"misspelled command", []string{"commission"}, true}, // nolint: misspell
{"no command provided", []string{}, false},
{"help flag", []string{"comission", "--help"}, false}, // nolint: misspell
{"shorthand help flag", []string{"comission", "-h"}, false}, // nolint: misspell
{"help flag", []string{"commission", "--help"}, false}, // nolint: misspell
{"shorthand help flag", []string{"commission", "-h"}, false}, // nolint: misspell
}

for _, tt := range tests {
Expand Down
5 changes: 3 additions & 2 deletions codec/amino_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package codec_test
import (
"testing"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/testdata"
"github.com/stretchr/testify/require"
amino "github.com/tendermint/go-amino"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/testdata"
)

func createTestCodec() *amino.Codec {
Expand Down
3 changes: 2 additions & 1 deletion codec/hybrid_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package codec_test
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/testdata"
"github.com/stretchr/testify/require"
)

func TestHybridCodec(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion codec/proto_codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package codec_test
import (
"testing"

"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/testdata"
"github.com/stretchr/testify/require"
)

func TestProtoCodec(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion types/address_bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"testing"
"time"

"github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/types"

"github.com/tendermint/tendermint/crypto/ed25519"
)

Expand Down
3 changes: 2 additions & 1 deletion types/decimal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"math/big"
"testing"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
yaml "gopkg.in/yaml.v2"

"github.com/cosmos/cosmos-sdk/codec"
)

// create a decimal from a decimal string (ex. "1234.5678")
Expand Down
3 changes: 2 additions & 1 deletion x/bank/client/rest/rest.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package rest

import (
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/gorilla/mux"

"github.com/cosmos/cosmos-sdk/client/context"
)

// RegisterRoutes - Central function to define routes that get registered by the main application
Expand Down
3 changes: 2 additions & 1 deletion x/bank/types/key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package types_test
import (
"testing"

"github.com/stretchr/testify/require"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/stretchr/testify/require"
)

func cloneAppend(bz []byte, tail []byte) (res []byte) {
Expand Down
7 changes: 4 additions & 3 deletions x/params/keeper/common_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package keeper_test

import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
)

func testComponents() (codec.Marshaler, sdk.Context, sdk.StoreKey, sdk.StoreKey, paramskeeper.Keeper) {
Expand Down
3 changes: 2 additions & 1 deletion x/params/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"reflect"
"testing"

"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/stretchr/testify/require"
)

func validateNoOp(_ interface{}) error { return nil }
Expand Down
3 changes: 2 additions & 1 deletion x/params/types/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"testing"
"time"

"github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/x/params/types"
)

func TestKeyTable(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion x/staking/types/commission.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package types
import (
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
yaml "gopkg.in/yaml.v2"

sdk "github.com/cosmos/cosmos-sdk/types"
)

// NewCommissionRates returns an initialized validator commission rates.
Expand Down
3 changes: 2 additions & 1 deletion x/staking/types/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"strings"
"time"

yaml "gopkg.in/yaml.v2"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/staking/exported"
yaml "gopkg.in/yaml.v2"
)

// Implements Delegation interface
Expand Down
3 changes: 2 additions & 1 deletion x/staking/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"strings"
"time"

yaml "gopkg.in/yaml.v2"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
yaml "gopkg.in/yaml.v2"
)

// Staking params default values
Expand Down
1 change: 1 addition & 0 deletions x/upgrade/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cli
import (
"encoding/binary"
"fmt"

"github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/spf13/cobra"
Expand Down
1 change: 1 addition & 0 deletions x/upgrade/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"encoding/binary"
"fmt"

"github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/tendermint/tendermint/libs/log"
Expand Down
1 change: 1 addition & 0 deletions x/upgrade/keeper/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keeper

import (
"encoding/binary"

"github.com/cosmos/cosmos-sdk/x/upgrade/types"

abci "github.com/tendermint/tendermint/abci/types"
Expand Down

0 comments on commit 5a2e59e

Please sign in to comment.