Fix linter errors thrown by lll (#3970)

* Fix long line errors in abci, crypto, and libs packages

* Fix long lines in p2p and rpc packages

* Fix long lines in abci, state, and tools packages

* Fix long lines in behaviour and blockchain packages

* Fix long lines in cmd and config packages

* Begin fixing long lines in consensus package

* Finish fixing long lines in consensus package

* Add lll exclusion for lines containing URLs

* Fix long lines in crypto package

* Fix long lines in evidence package

* Fix long lines in mempool and node packages

* Fix long lines in libs package

* Fix long lines in lite package

* Fix new long line in node package

* Fix long lines in p2p package

* Ignore gocritic warning

* Fix long lines in privval package

* Fix long lines in rpc package

* Fix long lines in scripts package

* Fix long lines in state package

* Fix long lines in tools package

* Fix long lines in types package

* Enable lll linter
This commit is contained in:
Phil Salant
2019-10-17 10:42:28 +02:00
committed by Marko
parent 8ba159834f
commit bc572217c0
112 changed files with 1673 additions and 358 deletions
+30 -8
View File
@@ -120,26 +120,36 @@ func (q *Query) Conditions() []Condition {
if strings.ContainsAny(number, ".") { // if it looks like a floating-point number
value, err := strconv.ParseFloat(number, 64)
if err != nil {
panic(fmt.Sprintf("got %v while trying to parse %s as float64 (should never happen if the grammar is correct)", err, number))
panic(fmt.Sprintf("got %v while trying to parse %s as float64 (should never happen if the grammar is correct)",
err,
number))
}
conditions = append(conditions, Condition{tag, op, value})
} else {
value, err := strconv.ParseInt(number, 10, 64)
if err != nil {
panic(fmt.Sprintf("got %v while trying to parse %s as int64 (should never happen if the grammar is correct)", err, number))
panic(fmt.Sprintf("got %v while trying to parse %s as int64 (should never happen if the grammar is correct)",
err,
number))
}
conditions = append(conditions, Condition{tag, op, value})
}
case ruletime:
value, err := time.Parse(TimeLayout, buffer[begin:end])
if err != nil {
panic(fmt.Sprintf("got %v while trying to parse %s as time.Time / RFC3339 (should never happen if the grammar is correct)", err, buffer[begin:end]))
panic(fmt.Sprintf(
"got %v while trying to parse %s as time.Time / RFC3339 (should never happen if the grammar is correct)",
err,
buffer[begin:end]))
}
conditions = append(conditions, Condition{tag, op, value})
case ruledate:
value, err := time.Parse("2006-01-02", buffer[begin:end])
if err != nil {
panic(fmt.Sprintf("got %v while trying to parse %s as time.Time / '2006-01-02' (should never happen if the grammar is correct)", err, buffer[begin:end]))
panic(fmt.Sprintf(
"got %v while trying to parse %s as time.Time / '2006-01-02' (should never happen if the grammar is correct)",
err,
buffer[begin:end]))
}
conditions = append(conditions, Condition{tag, op, value})
}
@@ -199,7 +209,10 @@ func (q *Query) Matches(events map[string][]string) bool {
if strings.ContainsAny(number, ".") { // if it looks like a floating-point number
value, err := strconv.ParseFloat(number, 64)
if err != nil {
panic(fmt.Sprintf("got %v while trying to parse %s as float64 (should never happen if the grammar is correct)", err, number))
panic(fmt.Sprintf(
"got %v while trying to parse %s as float64 (should never happen if the grammar is correct)",
err,
number))
}
if !match(tag, op, reflect.ValueOf(value), events) {
return false
@@ -207,7 +220,10 @@ func (q *Query) Matches(events map[string][]string) bool {
} else {
value, err := strconv.ParseInt(number, 10, 64)
if err != nil {
panic(fmt.Sprintf("got %v while trying to parse %s as int64 (should never happen if the grammar is correct)", err, number))
panic(fmt.Sprintf(
"got %v while trying to parse %s as int64 (should never happen if the grammar is correct)",
err,
number))
}
if !match(tag, op, reflect.ValueOf(value), events) {
return false
@@ -216,7 +232,10 @@ func (q *Query) Matches(events map[string][]string) bool {
case ruletime:
value, err := time.Parse(TimeLayout, buffer[begin:end])
if err != nil {
panic(fmt.Sprintf("got %v while trying to parse %s as time.Time / RFC3339 (should never happen if the grammar is correct)", err, buffer[begin:end]))
panic(fmt.Sprintf(
"got %v while trying to parse %s as time.Time / RFC3339 (should never happen if the grammar is correct)",
err,
buffer[begin:end]))
}
if !match(tag, op, reflect.ValueOf(value), events) {
return false
@@ -224,7 +243,10 @@ func (q *Query) Matches(events map[string][]string) bool {
case ruledate:
value, err := time.Parse("2006-01-02", buffer[begin:end])
if err != nil {
panic(fmt.Sprintf("got %v while trying to parse %s as time.Time / '2006-01-02' (should never happen if the grammar is correct)", err, buffer[begin:end]))
panic(fmt.Sprintf(
"got %v while trying to parse %s as time.Time / '2006-01-02' (should never happen if the grammar is correct)",
err,
buffer[begin:end]))
}
if !match(tag, op, reflect.ValueOf(value), events) {
return false