various linter fixes (#6106)

x/staking: Fix all linter warnings.

Fixed warnings across base packages.

New linters:
- unparam
- nolintlint

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
This commit is contained in:
Marko
2020-05-02 21:26:59 +02:00
committed by GitHub
co-authored by Alessio Treglia
parent 9251812f69
commit 218ec99508
103 changed files with 636 additions and 278 deletions
+2 -1
View File
@@ -87,6 +87,7 @@ func (app *BaseApp) FilterPeerByAddrPort(info string) abci.ResponseQuery {
if app.addrPeerFilter != nil {
return app.addrPeerFilter(info)
}
return abci.ResponseQuery{}
}
@@ -95,6 +96,7 @@ func (app *BaseApp) FilterPeerByID(info string) abci.ResponseQuery {
if app.idPeerFilter != nil {
return app.idPeerFilter(info)
}
return abci.ResponseQuery{}
}
@@ -136,7 +138,6 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg
if app.beginBlocker != nil {
res = app.beginBlocker(app.deliverState.ctx, req)
}
// set the signed validators for addition to context in deliverTx
app.voteInfos = req.LastCommitInfo.GetVotes()
return res
+13
View File
@@ -48,6 +48,7 @@ func (app *BaseApp) SetName(name string) {
if app.sealed {
panic("SetName() on sealed BaseApp")
}
app.name = name
}
@@ -56,6 +57,7 @@ func (app *BaseApp) SetParamStore(ps ParamStore) {
if app.sealed {
panic("SetParamStore() on sealed BaseApp")
}
app.paramStore = ps
}
@@ -64,6 +66,7 @@ func (app *BaseApp) SetAppVersion(v string) {
if app.sealed {
panic("SetAppVersion() on sealed BaseApp")
}
app.appVersion = v
}
@@ -71,6 +74,7 @@ func (app *BaseApp) SetDB(db dbm.DB) {
if app.sealed {
panic("SetDB() on sealed BaseApp")
}
app.db = db
}
@@ -78,6 +82,7 @@ func (app *BaseApp) SetCMS(cms store.CommitMultiStore) {
if app.sealed {
panic("SetEndBlocker() on sealed BaseApp")
}
app.cms = cms
}
@@ -85,6 +90,7 @@ func (app *BaseApp) SetInitChainer(initChainer sdk.InitChainer) {
if app.sealed {
panic("SetInitChainer() on sealed BaseApp")
}
app.initChainer = initChainer
}
@@ -92,6 +98,7 @@ func (app *BaseApp) SetBeginBlocker(beginBlocker sdk.BeginBlocker) {
if app.sealed {
panic("SetBeginBlocker() on sealed BaseApp")
}
app.beginBlocker = beginBlocker
}
@@ -99,6 +106,7 @@ func (app *BaseApp) SetEndBlocker(endBlocker sdk.EndBlocker) {
if app.sealed {
panic("SetEndBlocker() on sealed BaseApp")
}
app.endBlocker = endBlocker
}
@@ -106,6 +114,7 @@ func (app *BaseApp) SetAnteHandler(ah sdk.AnteHandler) {
if app.sealed {
panic("SetAnteHandler() on sealed BaseApp")
}
app.anteHandler = ah
}
@@ -113,6 +122,7 @@ func (app *BaseApp) SetAddrPeerFilter(pf sdk.PeerFilter) {
if app.sealed {
panic("SetAddrPeerFilter() on sealed BaseApp")
}
app.addrPeerFilter = pf
}
@@ -120,6 +130,7 @@ func (app *BaseApp) SetIDPeerFilter(pf sdk.PeerFilter) {
if app.sealed {
panic("SetIDPeerFilter() on sealed BaseApp")
}
app.idPeerFilter = pf
}
@@ -127,6 +138,7 @@ func (app *BaseApp) SetFauxMerkleMode() {
if app.sealed {
panic("SetFauxMerkleMode() on sealed BaseApp")
}
app.fauxMerkleMode = true
}
@@ -141,6 +153,7 @@ func (app *BaseApp) SetStoreLoader(loader StoreLoader) {
if app.sealed {
panic("SetStoreLoader() on sealed BaseApp")
}
app.storeLoader = loader
}
+2
View File
@@ -38,6 +38,7 @@ func ValidateBlockParams(i interface{}) error {
if v.MaxBytes <= 0 {
return fmt.Errorf("block maximum bytes must be positive: %d", v.MaxBytes)
}
if v.MaxGas < -1 {
return fmt.Errorf("block maximum gas must be greater than or equal to -1: %d", v.MaxGas)
}
@@ -56,6 +57,7 @@ func ValidateEvidenceParams(i interface{}) error {
if v.MaxAgeNumBlocks <= 0 {
return fmt.Errorf("evidence maximum age in blocks must be positive: %d", v.MaxAgeNumBlocks)
}
if v.MaxAgeDuration <= 0 {
return fmt.Errorf("evidence maximum age time duration must be positive: %v", v.MaxAgeDuration)
}
+2
View File
@@ -25,11 +25,13 @@ func (qrt *QueryRouter) AddRoute(path string, q sdk.Querier) sdk.QueryRouter {
if !isAlphaNumeric(path) {
panic("route expressions can only contain alphanumeric characters")
}
if qrt.routes[path] != nil {
panic(fmt.Sprintf("route %s has already been initialized", path))
}
qrt.routes[path] = q
return qrt
}