Update pending and skip statik in test_lint

This commit is contained in:
HaoyangLiu 2018-09-02 22:30:24 +08:00
parent e742b02d3b
commit e496bbd6f5
5 changed files with 29 additions and 26 deletions

View File

@ -167,7 +167,7 @@ test_cover:
@bash tests/test_cover.sh
test_lint:
gometalinter.v2 --config=tools/gometalinter.json ./...
gometalinter.v2 --config=tools/gometalinter.json ./... | grep -v "client/lcd/statik"
!(gometalinter.v2 --disable-all --enable='errcheck' --vendor ./... | grep -v "client/")
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s
dep status >> /dev/null

View File

@ -17,6 +17,7 @@ BREAKING CHANGES
* \#2040 All commands that utilize a validator's address must now use the new
bech32 prefix, `cosmosval`. A validator's Tendermint signing key and address
now use a new bech32 prefix, `cosmoscons`.
* [cli] \#2215 `gaiacli rest-server` was renamed to `gaiacli lite-server`. In `gaiacli lite-server`, swagger-ui is supported.
* Gaia
* Make the transient store key use a distinct store key. [#2013](https://github.com/cosmos/cosmos-sdk/pull/2013)

View File

@ -164,7 +164,28 @@ type NewKeyBody struct {
Seed string `json:"seed"`
}
// add new key REST handler
func paramCheck(m NewKeyBody, kb keys.Keybase) (int, string) {
if m.Name == "" {
return http.StatusBadRequest, fmt.Sprintf("You have to specify a name for the locally stored account.")
}
if m.Password == "" {
return http.StatusBadRequest, fmt.Sprintf("You have to specify a password for the locally stored account.")
}
// check if already exists
infos, err := kb.List()
if err != nil {
return http.StatusInternalServerError, err.Error()
}
for _, i := range infos {
if i.GetName() == m.Name {
return http.StatusConflict, fmt.Sprintf("Account with name %s already exists.", m.Name)
}
}
return http.StatusOK, ""
}
// AddNewKeyRequestHandler add new key REST handler
func AddNewKeyRequestHandler(w http.ResponseWriter, r *http.Request) {
var kb keys.Keybase
var m NewKeyBody
@ -190,32 +211,12 @@ func AddNewKeyRequestHandler(w http.ResponseWriter, r *http.Request) {
return
}
if err != nil {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(err.Error()))
code, errMsg := paramCheck(m, kb)
if code != http.StatusOK {
w.WriteHeader(code)
w.Write([]byte(errMsg))
return
}
if m.Name == "" {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte("You have to specify a name for the locally stored account."))
return
}
if m.Password == "" {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte("You have to specify a password for the locally stored account."))
return
}
// check if already exists
infos, err := kb.List()
for _, i := range infos {
if i.GetName() == m.Name {
w.WriteHeader(http.StatusConflict)
w.Write([]byte(fmt.Sprintf("Account with name %s already exists.", m.Name)))
return
}
}
// create account
seed := m.Seed
if seed == "" {

View File

@ -20,6 +20,7 @@ LCD will be used in the Cosmos Hub, the first Hub in the Cosmos network.
2. [**Get Started**](getting_started.md)
3. [**API**](api.md)
4. [**Specifications**](specification.md)
4. [**Update API docs To Swagger-UI**](update_API_docs.md)
## Overview