mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-03-30 15:08:28 +00:00
[ci] Improve staticcheck setup (#221)
* [staticcheck] Fix comments on exported functions and structs * [ci] Improve staticcheck setup - Add global staticcheck.conf file - Ignore: at least one file in a package should have a package comment (ST1000) - Ignore deprecation warnings. They are reported by golangci-lint and there we have a proper way to exclude generated files. Signed-off-by: Julian Strobl <jmastr@mailbox.org>
This commit is contained in:
parent
df8ece2a30
commit
363d82d344
6
.github/workflows/audit.yaml
vendored
6
.github/workflows/audit.yaml
vendored
@ -43,13 +43,7 @@ jobs:
|
|||||||
run: go install honnef.co/go/tools/cmd/staticcheck@latest
|
run: go install honnef.co/go/tools/cmd/staticcheck@latest
|
||||||
|
|
||||||
- name: Run staticcheck
|
- name: Run staticcheck
|
||||||
env:
|
|
||||||
LINT: "//lint:file-ignore SA1019 Ignore all deprecation errors, it's generated"
|
|
||||||
run: |
|
run: |
|
||||||
# Add lint-ignore comment to beginning of files
|
|
||||||
sed -i "1i${LINT}" ./x/asset/types/query.pb.gw.go
|
|
||||||
sed -i "1i${LINT}" ./x/machine/types/query.pb.gw.go
|
|
||||||
sed -i "1i${LINT}" ./x/dao/types/query.pb.gw.go
|
|
||||||
staticcheck ./...
|
staticcheck ./...
|
||||||
|
|
||||||
- name: Install golangci-lint
|
- name: Install golangci-lint
|
||||||
|
@ -6,8 +6,8 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The genesis state of the blockchain is represented here as a map of raw json
|
// GenesisState The genesis state of the blockchain is represented here as a
|
||||||
// messages key'd by a identifier string.
|
// map of raw json messages key'd by a identifier string.
|
||||||
// The identifier is used to determine which module genesis information belongs
|
// The identifier is used to determine which module genesis information belongs
|
||||||
// to so it may be appropriately routed during init chain.
|
// to so it may be appropriately routed during init chain.
|
||||||
// Within this application default genesis information is retrieved from
|
// Within this application default genesis information is retrieved from
|
||||||
|
@ -102,7 +102,7 @@ func (config *Config) SetRoot(root string) *Config {
|
|||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetWatchmenConfig sets Planetmint's configuration
|
// SetPlanetmintConfig sets Planetmint's configuration
|
||||||
func (config *Config) SetPlanetmintConfig(planetmintconfig interface{}) {
|
func (config *Config) SetPlanetmintConfig(planetmintconfig interface{}) {
|
||||||
jsonConfig, err := json.Marshal(planetmintconfig)
|
jsonConfig, err := json.Marshal(planetmintconfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
export LINT="//lint:file-ignore SA1019 Ignore all deprecation errors, it's generated"
|
|
||||||
|
|
||||||
# Add lint-ignore comment to beginning of files
|
|
||||||
sed -i "1i${LINT}" ./x/asset/types/query.pb.gw.go
|
|
||||||
sed -i "1i${LINT}" ./x/machine/types/query.pb.gw.go
|
|
||||||
sed -i "1i${LINT}" ./x/dao/types/query.pb.gw.go
|
|
1
staticcheck.conf
Normal file
1
staticcheck.conf
Normal file
@ -0,0 +1 @@
|
|||||||
|
checks = ["all", "-SA1019", "-ST1000"]
|
@ -35,7 +35,7 @@ const Fees = "1stake"
|
|||||||
// DefaultDerivationPath is the BIP44Prefix for PLMNT (see https://github.com/satoshilabs/slips/blob/master/slip-0044.md)
|
// DefaultDerivationPath is the BIP44Prefix for PLMNT (see https://github.com/satoshilabs/slips/blob/master/slip-0044.md)
|
||||||
const DefaultDerivationPath = "m/44'/8680'/0'/0/0"
|
const DefaultDerivationPath = "m/44'/8680'/0'/0/0"
|
||||||
|
|
||||||
// ConstantBech32Addr for mocks
|
// ConstBech32Addr constant bech32 address for mocks
|
||||||
const ConstBech32Addr = "plmnt10mq5nj8jhh27z7ejnz2ql3nh0qhzjnfvy50877"
|
const ConstBech32Addr = "plmnt10mq5nj8jhh27z7ejnz2ql3nh0qhzjnfvy50877"
|
||||||
|
|
||||||
// KeyPair returns a sample private / public keypair
|
// KeyPair returns a sample private / public keypair
|
||||||
@ -63,6 +63,7 @@ func Secp256k1AccAddress() sdk.AccAddress {
|
|||||||
return sdk.AccAddress(addr)
|
return sdk.AccAddress(addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Machine creates a new machine object
|
||||||
// TODO: make address deterministic for test cases
|
// TODO: make address deterministic for test cases
|
||||||
func Machine(name, pubKey string, prvKey string, address string) machinetypes.Machine {
|
func Machine(name, pubKey string, prvKey string, address string) machinetypes.Machine {
|
||||||
metadata := Metadata()
|
metadata := Metadata()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user