test(linters): Enable sloppyLen (#15512)
This commit is contained in:
parent
7037429e6a
commit
f55e02e8fd
|
|
@ -109,6 +109,7 @@ linters-settings:
|
||||||
- nilValReturn
|
- nilValReturn
|
||||||
- offBy1
|
- offBy1
|
||||||
- regexpPattern
|
- regexpPattern
|
||||||
|
- sloppyLen
|
||||||
- sloppyReassign
|
- sloppyReassign
|
||||||
- sloppyTypeAssert
|
- sloppyTypeAssert
|
||||||
- sortSlice
|
- sortSlice
|
||||||
|
|
|
||||||
|
|
@ -218,7 +218,7 @@ func (a *Aerospike) parseNodeInfo(acc telegraf.Accumulator, stats map[string]str
|
||||||
|
|
||||||
func (a *Aerospike) getNamespaces(n *as.Node, infoPolicy *as.InfoPolicy) ([]string, error) {
|
func (a *Aerospike) getNamespaces(n *as.Node, infoPolicy *as.InfoPolicy) ([]string, error) {
|
||||||
var namespaces []string
|
var namespaces []string
|
||||||
if len(a.Namespaces) <= 0 {
|
if len(a.Namespaces) == 0 {
|
||||||
info, err := n.RequestInfo(infoPolicy, "namespaces")
|
info, err := n.RequestInfo(infoPolicy, "namespaces")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return namespaces, err
|
return namespaces, err
|
||||||
|
|
@ -262,7 +262,7 @@ func (a *Aerospike) parseNamespaceInfo(acc telegraf.Accumulator, stats map[strin
|
||||||
func (a *Aerospike) getSets(n *as.Node, infoPolicy *as.InfoPolicy) ([]string, error) {
|
func (a *Aerospike) getSets(n *as.Node, infoPolicy *as.InfoPolicy) ([]string, error) {
|
||||||
var namespaceSets []string
|
var namespaceSets []string
|
||||||
// Gather all sets
|
// Gather all sets
|
||||||
if len(a.Sets) <= 0 {
|
if len(a.Sets) == 0 {
|
||||||
stats, err := n.RequestInfo(infoPolicy, "sets")
|
stats, err := n.RequestInfo(infoPolicy, "sets")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return namespaceSets, err
|
return namespaceSets, err
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ func (d *Dovecot) Gather(acc telegraf.Accumulator) error {
|
||||||
d.Servers = append(d.Servers, "127.0.0.1:24242")
|
d.Servers = append(d.Servers, "127.0.0.1:24242")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(d.Filters) <= 0 {
|
if len(d.Filters) == 0 {
|
||||||
d.Filters = append(d.Filters, "")
|
d.Filters = append(d.Filters, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ func (f *File) refreshFilePaths() error {
|
||||||
return fmt.Errorf("could not compile glob %q: %w", file, err)
|
return fmt.Errorf("could not compile glob %q: %w", file, err)
|
||||||
}
|
}
|
||||||
files := g.Match()
|
files := g.Match()
|
||||||
if len(files) <= 0 {
|
if len(files) == 0 {
|
||||||
return fmt.Errorf("could not find file(s): %v", file)
|
return fmt.Errorf("could not find file(s): %v", file)
|
||||||
}
|
}
|
||||||
allFiles = append(allFiles, files...)
|
allFiles = append(allFiles, files...)
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ func TestSubscribeClientIntegration(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(newRemaining) <= 0 {
|
if len(newRemaining) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -361,7 +361,7 @@ func TestSubscribeClientIntegrationAdditionalFields(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(newRemaining) <= 0 {
|
if len(newRemaining) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Test if the received metric matches one of the expected
|
// Test if the received metric matches one of the expected
|
||||||
|
|
|
||||||
|
|
@ -511,7 +511,7 @@ func (c *X509Cert) collectCertURLs() []*url.URL {
|
||||||
|
|
||||||
for _, path := range c.globpaths {
|
for _, path := range c.globpaths {
|
||||||
files := path.Match()
|
files := path.Match()
|
||||||
if len(files) <= 0 {
|
if len(files) == 0 {
|
||||||
c.Log.Errorf("could not find file: %v", path.GetRoots())
|
c.Log.Errorf("could not find file: %v", path.GetRoots())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue