Skip to content

Commit

Permalink
Rename signatures after comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Pérez-Aradros Herce committed Nov 15, 2018
1 parent 268dca4 commit 8bc8b24
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions x-pack/libbeat/management/blacklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (c *ConfigBlacklist) Filter(configBlocks api.ConfigBlocks) api.ConfigBlocks
newConfigs := api.ConfigBlocksWithType{Type: configs.Type}

for _, block := range configs.Blocks {
if c.blacklisted(configs.Type, block) {
if c.isBlacklisted(configs.Type, block) {
logp.Err("Got a blacklisted configuration, ignoring it")
continue
}
Expand All @@ -98,7 +98,7 @@ func (c *ConfigBlacklist) Filter(configBlocks api.ConfigBlocks) api.ConfigBlocks
return result
}

func (c *ConfigBlacklist) blacklisted(blockType string, block *api.ConfigBlock) bool {
func (c *ConfigBlacklist) isBlacklisted(blockType string, block *api.ConfigBlock) bool {
cfg, err := block.ConfigWithMeta()
if err != nil {
return false
Expand All @@ -117,7 +117,7 @@ func (c *ConfigBlacklist) blacklisted(blockType string, block *api.ConfigBlock)
if len(field) > 0 {
segments = strings.Split(field, ".")
}
if c.blockMatches(pattern, segments, cfg.Config) {
if c.isBlacklistedBlock(pattern, segments, cfg.Config) {
return true
}
}
Expand All @@ -126,7 +126,7 @@ func (c *ConfigBlacklist) blacklisted(blockType string, block *api.ConfigBlock)
return false
}

func (c *ConfigBlacklist) blockMatches(pattern *regexp.Regexp, segments []string, current *common.Config) bool {
func (c *ConfigBlacklist) isBlacklistedBlock(pattern *regexp.Regexp, segments []string, current *common.Config) bool {
if current.IsDict() {
switch len(segments) {
case 0:
Expand All @@ -144,12 +144,12 @@ func (c *ConfigBlacklist) blockMatches(pattern *regexp.Regexp, segments []string
}
// not a string, traverse
child, _ := current.Child(segments[0], -1)
return child != nil && c.blockMatches(pattern, segments[1:], child)
return child != nil && c.isBlacklistedBlock(pattern, segments[1:], child)

default:
// traverse the tree
child, _ := current.Child(segments[0], -1)
return child != nil && c.blockMatches(pattern, segments[1:], child)
return child != nil && c.isBlacklistedBlock(pattern, segments[1:], child)

}
}
Expand All @@ -167,7 +167,7 @@ func (c *ConfigBlacklist) blockMatches(pattern *regexp.Regexp, segments []string
// not a string, traverse
child, _ := current.Child("", count-1)
if child != nil {
if c.blockMatches(pattern, segments, child) {
if c.isBlacklistedBlock(pattern, segments, child) {
return true
}
}
Expand All @@ -177,7 +177,7 @@ func (c *ConfigBlacklist) blockMatches(pattern *regexp.Regexp, segments []string
// List of elements, explode traversal to all of them
for count, _ := current.CountField(""); count > 0; count-- {
child, _ := current.Child("", count-1)
if child != nil && c.blockMatches(pattern, segments, child) {
if child != nil && c.isBlacklistedBlock(pattern, segments, child) {
return true
}
}
Expand Down

0 comments on commit 8bc8b24

Please sign in to comment.